MicrosoftGridSample

Description

Given anΒ inputΒ and a flow-fieldΒ grid, computes theΒ outputΒ usingΒ inputΒ values and pixel locations fromΒ grid. Currently, only spatial (4-D) inputs are supported. ForΒ inputΒ with shape (N, C, H, W) andΒ gridΒ with shape (N, H_out, W_out, 2), theΒ outputΒ will have shape (N, C, H_out, W_out). For each output locationΒ output[n, :, h, w], the size-2 vectorΒ grid[n, h, w]Β specifiesΒ inputΒ pixel locationsΒ xΒ andΒ y, which are used to interpolate the output valueΒ output[n, :, h, w]. The GridSample operator is often used in doing grid generator and sampler in theΒ Spatial Transformer Networks. See also inΒ torch.nn.functional.grid_sample.

 

Input parameters

 

specified_outputs_name :Β array, this parameter lets you manually assign custom names to the output tensors of a node.

Β Graphs in :Β cluster, ONNX model architecture.

X (heterogeneous) – T1 :Β object, 4-D tensor of shape (N, C, H, W), where N is the batch size, C is the numbers of channels, H and W are the height and width of the input data.
grid (heterogeneous) – T1 : object, input offset, 4-D tensor of shape (N, H_out, W_out, 2), where H_out and W_out are the height and width of grid and output, Grid specifies the sampling pixel locations normalized by the input spatial dimensions. Therefore, it should have most values in the range of [-1, 1]. If grid has values outside the range of [-1, 1], the corresponding outputs will be handled as defined by padding_mode.

Β Parameters :Β cluster,

align_cornersΒ :Β boolean, if align_corners=true, the extrema (-1 and 1) are considered as referring to the center points of the input’s corner pixels. If align_corners=false, they are instead considered as referring to the corner points of the input’s corner pixels, making the sampling more resolution agnostic.
Default value β€œFalse”.
mode : enum, three interpolation modes.
Default value β€œbilinear”.
padding_modeΒ : enum, support padding modes for outside grid values. zeros: use 0 for out-of-bound grid locations, border: use border values for out-of-bound grid locations, reflection: use values at locations reflected by the border for out-of-bound grid locations.
Default value β€œzeros”.
Β training?Β :Β boolean, whether the layer is in training mode (can store data for backward).
Default value β€œTrue”.
Β lda coeff :Β float, defines the coefficient by which the loss derivative will be multiplied before being sent to the previous layer (since during the backward run we go backwards).
Default value β€œ1”.

Β name (optional) :Β string, name of the node.

Output parameters

 

Β Y (heterogeneous) – T2 : object, 4-D tensor of shape (N, C, H_out, W_out).

Type Constraints

T1 in (tensor(uint8),Β tensor(uint16),Β tensor(uint32),Β tensor(uint64),Β tensor(int8),Β tensor(int16),Β tensor(int32),
tensor(int64),Β tensor(float16),Β tensor(float),Β tensor(double),Β tensor(string),Β tensor(bool),Β tensor(complex64),Β tensor(complex128)) : Constrain input types to all tensor types.

T2 in (tensor(double),Β tensor(float),Β tensor(float16)) : Constrain output types to float tensors.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Deep Learning library to run it).
Table of Contents