NVIDIA NvNeural SDK
2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
|
Defines a standard input layer. More...
#include <nvneural/layers/IStandardInputLayer.h>
Public Member Functions | |
Padding and tiling | |
Input tensors can be padded so that their H and W dimensions are multiples of a constant. They can also be padded to a certain minimum C dimension. To disable either of these features, set them to zero. Tiling is disabled by default. Channel padding is enabled by default, and typically takes its minimum from the "dims" parameter's C component. | |
virtual std::size_t | tilingFactor () const noexcept=0 |
Retrieves the current H/W tiling value. Zero means no tiling. | |
virtual NeuralResult | setTilingFactor (std::size_t tileFactor) noexcept=0 |
Sets a new H/W tiling value. More... | |
virtual std::size_t | minimumChannelCount () const noexcept=0 |
Retrieves the current minimum channel count. Zero means no minimum. | |
virtual NeuralResult | setMinimumChannelCount (std::size_t minChannels) noexcept=0 |
Sets a new minimum channel count. More... | |
virtual NeuralResult | regeneratePlaceholderNoise () noexcept=0 |
Requests new placeholder noise. More... | |
virtual TensorDimension | placeholderSize () const noexcept=0 |
Retrieves the current size for autogenerated placeholder data. | |
virtual NeuralResult | setPlaceholderSize (TensorDimension placeholderSize) noexcept=0 |
Sets a new default size for placeholder data. More... | |
virtual bool | imagesUseAlpha () const noexcept=0 |
Returns true if alpha channels will be preserved in loaded images. More... | |
virtual NeuralResult | setImagesUseAlpha (bool rgba) noexcept=0 |
Control whether alpha channels will be preserved in loaded images. More... | |
Shift and scale | |
When loading through loadCpuBuffer or loadImage, you can apply a linear transformation to the incoming data. This transformation is defined as follows, where "in" is in the normalized range [0, 1.0]: out = (in - shift) * scale The shift and scale parameters can be controlled with this interface, and default to 0.5 and 1.0. | |
virtual NeuralResult | setImageShift (float shift) noexcept=0 |
Set a new shift coefficient for loadImage calls. More... | |
virtual float | imageShift () const noexcept=0 |
Get the current shift coefficient for loadImage calls. | |
virtual NeuralResult | setImageScale (float scale) noexcept=0 |
Set a new scale coefficient for loadImage calls. More... | |
virtual float | imageScale () const noexcept=0 |
Get the current scale coefficient for loadImage calls. | |
Loading | |
These functions load an input tensor. The provided data buffer is converted to the layer's tensor format (typically the preferred format of the network), and image data are transformed with a linear operation determined by "scale" and "shift" parameters. This interface assumes tensors that come from numpy or raw CPU memory have already been mapped to the desired numeric ranges. Tensors that come from image data (uint8_t type) are mapped linearly 0x00->0.0f, 0xFF->1.0f before applying further transformations. | |
virtual NeuralResult | loadDetectedFile (const char *filename) noexcept=0 |
Loads a tensor from a disk file using either loadNumpy or loadImage as appropriate. More... | |
virtual NeuralResult | loadNumpy (const char *filename) noexcept=0 |
Loads a tensor from a NumPy (.npy) tensor on disk. More... | |
virtual NeuralResult | loadImage (const char *filename) noexcept=0 |
Loads a tensor from an image file on disk. Applies shift and scale transforms. | |
virtual NeuralResult | loadImageBuffer (const std::uint8_t *pBuffer, TensorDimension bufferSize) noexcept=0 |
Loads a tensor from a decoded image bitmap in NCHW layout. Applies shift and scale transforms. | |
virtual NeuralResult | loadCpuBuffer (const void *pBuffer, TensorDimension bufferSize, TensorFormat bufferFormat) noexcept=0 |
Loads a tensor from a raw CPU buffer. More... | |
![]() | |
virtual RefCount | addRef () const noexcept=0 |
Increments the object's reference count. More... | |
virtual const void * | queryInterface (TypeId interface) const noexcept=0 |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
virtual void * | queryInterface (TypeId interface) noexcept=0 |
Retrieves a new object interface pointer. More... | |
virtual RefCount | release () const noexcept=0 |
Decrements the object's reference count and destroy the object if the reference count reaches zero. More... | |
Static Public Attributes | |
static const IRefObject::TypeId | typeID = 0xa6746df041d5e61aul |
Interface TypeId for InterfaceOf purposes. | |
![]() | |
static const TypeId | typeID = 0x14ecc3f9de638e1dul |
Interface TypeId for InterfaceOf purposes. | |
Additional Inherited Members | |
![]() | |
using | RefCount = std::uint32_t |
Typedef used to track the number of active references to an object. | |
using | TypeId = std::uint64_t |
Every interface must define a unique TypeId. This should be randomized. | |
![]() | |
virtual | ~IRefObject ()=default |
A protected destructor prevents accidental stack-allocation of IRefObjects or use with other smart pointer classes like std::unique_ptr. | |
Defines a standard input layer.
Layers implementing this interface can be controlled by the tools that accompany NvNeural. Note that IInputLayer is a type trait that should accompany this interface in almost all cases.
|
pure virtualnoexcept |
Returns true if alpha channels will be preserved in loaded images.
Corresponds to the "rgba" parameter.
|
pure virtualnoexcept |
Loads a tensor from a raw CPU buffer.
fp32/fp16 and nchw/nhwc are all explicitly supported, and implementations may support other formats.
pBuffer | Pointer to the first element of an appropriately sized buffer |
bufferSize | Size of the buffer in elements |
bufferFormat | TensorFormat describing the element type and layout |
|
pure virtualnoexcept |
Loads a tensor from a disk file using either loadNumpy or loadImage as appropriate.
Used in command-line tools and generated code samples, but "real" applications should use the buffer functions and their own I/O handling to reduce potential confusion.
|
pure virtualnoexcept |
Loads a tensor from a NumPy (.npy) tensor on disk.
Does not apply shift and scale transforms.
Only fp32/nchw tensors are supported. Tensor shapes of fewer than four dimensions are interpreted as follows: 1 1, C, 1, 1 2 1, 1, H, W 3 1, C, H, W
|
pure virtualnoexcept |
Requests new placeholder noise.
The next time the layer is inferenced, the layer will generate new placeholder noise. Loading an image or tensor cancels the placeholder request.
|
pure virtualnoexcept |
Set a new scale coefficient for loadImage calls.
Does not affect previously loaded data.
|
pure virtualnoexcept |
Set a new shift coefficient for loadImage calls.
Does not affect previously loaded data.
|
pure virtualnoexcept |
Control whether alpha channels will be preserved in loaded images.
This defaults to false. If false, only the first three channels of an input image are used to build the input layer's tensor.
|
pure virtualnoexcept |
Sets a new minimum channel count.
Input tensors are zero-extended such that C is at least this value. Pass zero to disable this behavior (equivalent to 1). Does not affect previously loaded data.
|
pure virtualnoexcept |
Sets a new default size for placeholder data.
The C component of this dimension is treated equivalently to a call to setMinimumChannelCount. N, W, and H components are discarded upon loading a tensor (in any format).
|
pure virtualnoexcept |
Sets a new H/W tiling value.
Input tensors are zero-extended such that H and W are multiples of the provided tiling factor. Pass zero to disable this behavior (equivalent to 1). Does not affect previously loaded data.