module onnxrt.ops_cpu.op_shape#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_shape

Short summary#

module mlprodict.onnxrt.ops_cpu.op_shape

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

Shape

Shape ===== Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. Optional …

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_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

Methods#

method

truncated documentation

__init__

_infer_shapes

_infer_sizes

_infer_types

_run

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_shape.Shape(onnx_node, desc=None, **options)#

Bases: mlprodict.onnxrt.ops_cpu._op.OpRun

Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. Optional attributes start and end can be used to compute a slice of the input tensor’s shape. If start axis is omitted, the slice starts from axis 0. The end axis, if specified, is exclusive (and the returned value will not include the size of that axis). If the end axis is omitted, the axes upto the last one will be included. Negative axes indicate counting back from the last axis. Note that axes will be clipped to the range [0, r-1], where r is the rank of the input tensor if they are out-of-range (after adding r in the case of negative axis). Thus, specifying any end value > r is equivalent to specifying an end value of r, and specifying any start value < -r is equivalent to specifying a start value of 0.

For example: Input tensor with shape: [2, 3, 4] No attributes specified. Output: [2, 3, 4]

Input tensor with shape: [2, 3, 4] start: -1 Output: [4]

Input tensor with shape: [2, 3, 4] end: -1 Output: [2, 3]

Input tensor with shape: [2, 3, 4] start: 1 end: 2 Output: [3]

Attributes

  • end: (Optional) Ending axis for slicing the shape. Negative value means counting dimensions from the back. If omitted, sizes of all axes upto (including) the last one will be included. default value cannot be automatically retrieved (INT)

  • start: (Optional) Starting axis for slicing the shape. Default value is 0.Negative value means counting dimensions from the back. Default value is namestarti0typeINT (INT)

Inputs

  • data (heterogeneous)T: An input tensor.

Outputs

  • shape (heterogeneous)T1: Shape of the input tensor

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): Input tensor can be of arbitrary type.

  • T1 tensor(int64): Constrain output to int64 tensor.

Version

Onnx name: Shape

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

Runtime implementation: Shape

Parameters
  • onnx_nodeonnx node

  • desc – internal representation

  • expected_attributes – expected attributes for this node

  • options – runtime options

source on GitHub

__init__(onnx_node, desc=None, **options)#
Parameters
  • onnx_nodeonnx node

  • desc – internal representation

  • expected_attributes – expected attributes for this node

  • options – runtime options

source on GitHub

_infer_shapes(x)#

Should be overwritten.

source on GitHub

_infer_sizes(*args, **kwargs)#

Should be overwritten.

source on GitHub

_infer_types(x)#

Should be overwritten.

source on GitHub

_run(data)#

Should be overwritten.

source on GitHub