NVIDIA NvNeural SDK
2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
|
Common helper classes and template function implementations. More...
#include <atomic>
#include <functional>
#include <string>
#include <typeinfo>
#include <type_traits>
#include <utility>
#include <nvneural/CoreTypes.h>
#include <nvneural/LayerTypes.h>
#include <nvneural/RefPtr.h>
#include <nvneural/RefObject.h>
Go to the source code of this file.
Classes | |
struct | std::hash< nvneural::NetworkBackendId > |
Specialization of std::hash for strongly typed network backends. More... | |
Enumerations | |
enum class | nvneural::TensorDimensionParseOrder : std::uint32_t { Tensor = 0 , Image = 1 } |
Order to read TensorDimension components in for TensorDimensionFromString. More... | |
Functions | |
TensorDimension | nvneural::align (const TensorDimension &dim, const TensorDimension &stepping) noexcept |
Rounds a TensorDimension object up to be a multiple of a provided set of strides. More... | |
constexpr std::size_t | nvneural::dataSize (TensorDataType dataType) noexcept |
Returns the size of an individual tensor element of a particular type, similar to sizeof. More... | |
ILogger * | nvneural::DefaultLogger () |
Returns a pointer to the default logger for this module. More... | |
template<typename TDividend , typename TDivisor > | |
constexpr auto | nvneural::DivideRoundingUp (TDividend dividend, TDivisor divisor) noexcept |
Division operation, rounding up. More... | |
NeuralResult | nvneural::getInputLayerIndex (ILayer *pLayer, ILayer *pInputLayer, size_t *pIndex) |
Retrieves the layer index in the input list. More... | |
void | nvneural::SetDefaultLogger (ILogger *pDefaultLogger) |
Sets a default logger for the module. | |
std::vector< std::string > | nvneural::split (std::string strToSplit, char delimiter, bool skip_empty=false) |
Splits a string by a delimiter, returns a vector of the split strings. More... | |
std::vector< std::string > | nvneural::splitEscape (std::string strToSplit, char delimiter, bool skip_empty=false) |
Splits a string by a delimiter, returns a vector of the split strings. More... | |
NeuralResult | nvneural::TensorDimensionFromString (TensorDimension &outDim, const std::string &dimStr, TensorDimensionParseOrder parseOrder, size_t fillValue) noexcept |
Parses a TensorDimension from a UTF-8 string. More... | |
std::string | nvneural::TensorDimensionToString (const TensorDimension &dim) noexcept |
Converts a TensorDimension to a UTF-8 string. More... | |
Common helper classes and template function implementations.
|
strong |
Order to read TensorDimension components in for TensorDimensionFromString.
|
inlinenoexcept |
Rounds a TensorDimension object up to be a multiple of a provided set of strides.
Dimensions are rounded individually by component.
dim | Size to round up |
stepping | Component multiples to round up to |
|
inlineconstexprnoexcept |
Returns the size of an individual tensor element of a particular type, similar to sizeof.
You should implement your own version of the function if working with custom types; unsupported types will return zero.
dataType | Type to query |
ILogger * nvneural::DefaultLogger | ( | ) |
Returns a pointer to the default logger for this module.
If no logger has been assigned via IPlugin::setDefaultLogger or SetDefaultLogger, the logger will silently ignore all messages sent to it.
|
inlineconstexprnoexcept |
Division operation, rounding up.
The primary application of this helper is CUDA grid launches: assuming a grid of "dividend" threads to launch, and a block size of "divisor" threads per block, the return value of this function will be the appropriate number of blocks to launch.
TDividend | Type of the dividend; should be integer-like |
TDivisor | Type of the divisor; should be integer-like |
dividend | Value to divide |
divisor | Value to divide by |
|
inline |
Retrieves the layer index in the input list.
pLayer | the layer to scan inputs from |
pInputLayer | one of the input layer |
pIndex | index output |
|
inline |
Splits a string by a delimiter, returns a vector of the split strings.
This is generally used when splitting dimensions (IE 1x1 or 1x1,1x1). There is an optional flag that allows skipping of empty split strings.
strToSplit | the string to split |
delimiter | single character that denotes the delimiter |
skip_empty | optional, skips returning empty split strings |
|
inline |
Splits a string by a delimiter, returns a vector of the split strings.
This version considers escaped characters.
This is generally used when splitting text strings where escaped characters can be used in the text itself. There is an optional flag that allows skipping of empty split strings.
strToSplit | the string to split |
delimiter | single character that denotes the delimiter |
skip_empty | optional, skips returning empty split strings |
|
noexcept |
Parses a TensorDimension from a UTF-8 string.
The interpretations of strings like "2x3x4" are determined by the parse order. Alternately, dimensions may be specified explicitly ("2w4c"). Mixed use of implicit and explicit dimensions ("4n5x6") is not permitted within the same input string.
outDim | TensorDimension variable receiving the parsed value. |
dimStr | String to parse. |
parseOrder | Order for parsing components if not explicit in the string. |
fillValue | Value to fill unparsed components with. |
|
noexcept |
Converts a TensorDimension to a UTF-8 string.
The string uses explicit component syntax for unambiguous round-trips through the TensorDimensionFromString function.
dim | Dimension to convert |