Welcome to our Support Center

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_namearray, 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