module onnxrt.ops_cpu.op_depth_to_space#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_depth_to_space

Short summary#

module mlprodict.onnxrt.ops_cpu.op_depth_to_space

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

DepthToSpace

DepthToSpace ============ DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. This is the reverse …

SpaceToDepth

SpaceToDepth ============ SpaceToDepth rearranges blocks of spatial data into depth. More specifically, this op outputs …

Properties#

property

truncated documentation

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default_modified

Returns the list of modified parameters.

args_default_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

atts_value

Returns all parameters in a dictionary.

Methods#

method

truncated documentation

__init__

__init__

_infer_shapes

_infer_shapes

_run

_run

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_depth_to_space.DepthToSpace(onnx_node, desc=None, **options)#

Bases: OpRun

DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of the input tensor where values from the depth dimension are moved in spatial blocks to the height and width dimensions. By default, mode = DCR. In the DCR mode, elements along the depth dimension from the input tensor are rearranged in the following order: depth, column, and then row. The output y is computed from the input x as below:

b, c, h, w = x.shape

tmp = np.reshape(x, [b, blocksize, blocksize, c // (blocksize**2), h, w])

tmp = np.transpose(tmp, [0, 3, 4, 1, 5, 2])

y = np.reshape(tmp, [b, c // (blocksize**2), h * blocksize, w * blocksize])

In the CRD mode, elements along the depth dimension from the input tensor are rearranged in the following order: column, row, and the depth. The output y is computed from the input x as below:

b, c, h, w = x.shape

tmp = np.reshape(x, [b, c // (blocksize ** 2), blocksize, blocksize, h, w])

tmp = np.transpose(tmp, [0, 1, 4, 2, 5, 3])

y = np.reshape(tmp, [b, c // (blocksize ** 2), h * blocksize, w * blocksize])

Attributes

  • blocksize (required): Blocks of [blocksize, blocksize] are moved. default value cannot be automatically retrieved (INT)

  • mode: DCR (default) for depth-column-row order re-arrangement. Use CRD for column-row-depth order. Default value is namemodesDCRtypeSTRING (STRING)

Inputs

  • input (heterogeneous)T: Input tensor of [N,C,H,W], where N is the batch axis, C is the channel or depth, H is the height and W is the width.

Outputs

  • output (heterogeneous)T: Output tensor of [N, C/(blocksize * blocksize), H * blocksize, W * blocksize].

Type Constraints

  • T tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(bfloat16), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128): Constrain input and output types to all tensor types.

Version

Onnx name: DepthToSpace

This version of the operator has been available since version 13.

Runtime implementation: DepthToSpace

__init__(onnx_node, desc=None, **options)#
_infer_shapes(data)#

Should be overwritten.

source on GitHub

_run(data, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_depth_to_space.SpaceToDepth(onnx_node, desc=None, **options)#

Bases: OpRun

SpaceToDepth rearranges blocks of spatial data into depth. More specifically, this op outputs a copy of the input tensor where values from the height and width dimensions are moved to the depth dimension.

Attributes

  • blocksize (required): Blocks of [blocksize, blocksize] are moved. default value cannot be automatically retrieved (INT)

Inputs

  • input (heterogeneous)T: Input tensor of [N,C,H,W], where N is the batch axis, C is the channel or depth, H is the height and W is the width.

Outputs

  • output (heterogeneous)T: Output tensor of [N, C * blocksize * blocksize, H/blocksize, W/blocksize].

Type Constraints

  • T tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(bfloat16), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128): Constrain input and output types to all tensor types.

Version

Onnx name: SpaceToDepth

This version of the operator has been available since version 13.

Runtime implementation: SpaceToDepth

__init__(onnx_node, desc=None, **options)#
_infer_shapes(data)#

Should be overwritten.

source on GitHub

_run(data, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub