TensorRT 8.2.3
|
A resize layer in a network definition. More...
#include <NvInfer.h>
Public Member Functions | |
void | setOutputDimensions (Dims dimensions) noexcept |
Set the output dimensions. More... | |
Dims | getOutputDimensions () const noexcept |
Get the output dimensions. More... | |
void | setScales (const float *scales, int32_t nbScales) noexcept |
Set the resize scales. More... | |
int32_t | getScales (int32_t size, float *scales) const noexcept |
Copies resize scales to scales[0, ..., nbScales-1], where nbScales is the number of scales that were set. More... | |
void | setResizeMode (ResizeMode resizeMode) noexcept |
Set resize mode for an input tensor. More... | |
ResizeMode | getResizeMode () const noexcept |
Get resize mode for an input tensor. More... | |
TRT_DEPRECATED void | setAlignCorners (bool alignCorners) noexcept |
Set whether to align corners while resizing. More... | |
TRT_DEPRECATED bool | getAlignCorners () const noexcept |
True if align corners has been set. More... | |
void | setCoordinateTransformation (ResizeCoordinateTransformation coordTransform) noexcept |
Set coordinate transformation function. More... | |
ResizeCoordinateTransformation | getCoordinateTransformation () const noexcept |
Get coordinate transformation function. More... | |
void | setSelectorForSinglePixel (ResizeSelector selector) noexcept |
Set coordinate selector function when resized to single pixel. More... | |
ResizeSelector | getSelectorForSinglePixel () const noexcept |
Get the coordinate selector function when resized to single pixel. More... | |
void | setNearestRounding (ResizeRoundMode value) noexcept |
Set rounding mode for nearest neighbor resize. More... | |
ResizeRoundMode | getNearestRounding () const noexcept |
Get rounding mode for nearest neighbor resize. More... | |
void | setInput (int32_t index, ITensor &tensor) noexcept |
Append or replace an input of this layer with a specific tensor. More... | |
Public Member Functions inherited from nvinfer1::ILayer | |
LayerType | getType () const noexcept |
Return the type of a layer. More... | |
void | setName (const char *name) noexcept |
Set the name of a layer. More... | |
const char * | getName () const noexcept |
Return the name of a layer. More... | |
int32_t | getNbInputs () const noexcept |
Get the number of inputs of a layer. | |
ITensor * | getInput (int32_t index) const noexcept |
Get the layer input corresponding to the given index. More... | |
int32_t | getNbOutputs () const noexcept |
Get the number of outputs of a layer. | |
ITensor * | getOutput (int32_t index) const noexcept |
Get the layer output corresponding to the given index. More... | |
void | setInput (int32_t index, ITensor &tensor) noexcept |
Replace an input of this layer with a specific tensor. More... | |
void | setPrecision (DataType dataType) noexcept |
Set the computational precision of this layer. More... | |
DataType | getPrecision () const noexcept |
get the computational precision of this layer More... | |
bool | precisionIsSet () const noexcept |
whether the computational precision has been set for this layer More... | |
void | resetPrecision () noexcept |
reset the computational precision for this layer More... | |
void | setOutputType (int32_t index, DataType dataType) noexcept |
Set the output type of this layer. More... | |
DataType | getOutputType (int32_t index) const noexcept |
get the output type of this layer More... | |
bool | outputTypeIsSet (int32_t index) const noexcept |
whether the output type has been set for this layer More... | |
void | resetOutputType (int32_t index) noexcept |
reset the output type for this layer More... | |
Protected Attributes | |
apiv::VResizeLayer * | mImpl |
Protected Attributes inherited from nvinfer1::ILayer | |
apiv::VLayer * | mLayer |
Additional Inherited Members | |
Protected Member Functions inherited from nvinfer1::INoCopy | |
INoCopy (const INoCopy &other)=delete | |
INoCopy & | operator= (const INoCopy &other)=delete |
INoCopy (INoCopy &&other)=delete | |
INoCopy & | operator= (INoCopy &&other)=delete |
A resize layer in a network definition.
Resize layer can be used for resizing a N-D tensor.
Resize layer currently supports the following configurations:
m
dimensions of N-D, where 0 < m <= min(8, N) and N > 0m
dimensions of N-D, where 0 < m <= min(3, N) and N > 0Default resize mode is ResizeMode::kNEAREST.
Resize layer provides two ways to resize tensor dimensions.
|
inlinenoexcept |
True if align corners has been set.
|
inlinenoexcept |
Get coordinate transformation function.
|
inlinenoexcept |
Get rounding mode for nearest neighbor resize.
|
inlinenoexcept |
Get the output dimensions.
|
inlinenoexcept |
Get resize mode for an input tensor.
|
inlinenoexcept |
Copies resize scales to scales[0, ..., nbScales-1], where nbScales is the number of scales that were set.
size | The number of scales to get. If size != nbScales, no scales will be copied. |
scales | Pointer to where to copy the scales. Scales will be copied only if size == nbScales and scales != nullptr. |
In case the size is not known consider using size = 0 and scales = nullptr. This method will return the number of resize scales.
|
inlinenoexcept |
Get the coordinate selector function when resized to single pixel.
|
inlinenoexcept |
Set whether to align corners while resizing.
If true, the centers of the 4 corner pixels of both input and output tensors are aligned i.e. preserves the values of corner pixels.
Default: false.
|
inlinenoexcept |
Set coordinate transformation function.
The function maps a coordinate in the output tensor to a coordinate in the input tensor.
Default function is ResizeCoordinateTransformation::kASYMMETRIC.
If executing this layer on DLA, only ResizeCoordinateTransformation::kASYMMETRIC is supported.
|
inlinenoexcept |
Append or replace an input of this layer with a specific tensor.
index | the index of the input to modify. |
tensor | the new input tensor. |
Sets the input tensor for the given index. The index must be 0 for a static resize layer. A static resize layer is converted to a dynamic resize layer by calling setInput with an index 1. A dynamic resize layer cannot be converted back to a static resize layer.
For a dynamic resize layer, the values 0 and 1 are valid. The indices in the dynamic case are as follows:
If this function is called with the value 1, then the function getNbInputs() changes from returning 1 to 2.
|
inlinenoexcept |
Set rounding mode for nearest neighbor resize.
This value is used for nearest neighbor interpolation rounding. It is applied after coordinate transformation.
Default is kFLOOR.
If executing this layer on DLA, only ResizeRoundMode::kFLOOR is supported.
|
inlinenoexcept |
Set the output dimensions.
dimensions | The output dimensions. Number of output dimensions must be the same as the number of input dimensions. |
If executing this layer on DLA, setOutputDimensions() is not supported.
If there is a second input, i.e. resize layer is dynamic, calling setOutputDimensions() is an error and does not update the dimensions.
Output dimensions can be specified directly, or via scale factors relative to input dimensions. Scales for resize can be provided using setScales().
|
inlinenoexcept |
Set resize mode for an input tensor.
Supported resize modes are Nearest Neighbor and Linear.
If executing this layer on DLA, only ResizeMode::kNEAREST is supported.
|
inlinenoexcept |
Set the resize scales.
scales | An array of resize scales. |
nbScales | Number of scales. Number of scales must be equal to the number of input dimensions. |
If executing this layer on DLA, there are three restrictions: 1) nbScales has to be exactly 4. 2) the first two elements in scales need to be exactly 1 (for unchanged batch and channel dimensions). 3) The last two elements in scales, representing the scale values along height and width dimensions, respectively, need to be integer values in the range of [1, 32]. Example of DLA-supported scales: {1, 1, 2, 2}.
If there is a second input, i.e. resize layer is dynamic, calling setScales() is an error and does not update the scales.
Output dimensions are calculated as follows: outputDims[i] = floor(inputDims[i] * scales[i])
Output dimensions can be specified directly, or via scale factors relative to input dimensions. Output dimensions can be provided directly using setOutputDimensions().
|
inlinenoexcept |
Set coordinate selector function when resized to single pixel.
When resize to single pixel image, use this function to decide how to map the coordinate in the original image.
Default is ResizeSelector::kFORMULA.
If executing this layer on DLA, only ResizeSelector::kFORMULA is supported.