npx.npx_types#

DType#

class onnx_array_api.npx.npx_types.DType(code: int | str)[source]#

Type of the element type returned by tensors following the Array API.

Parameters:

code – element type based on onnx definition, if str, it looks into class onnx.TensorProto to retrieve the code

classmethod type_name() str[source]#

Returns its full name.

ElemType#

class onnx_array_api.npx.npx_types.ElemType[source]#

Allowed element type based on numpy dtypes.

Parameters:

dtype – DType or a string

classmethod get_set_name(dtypes)[source]#

Returns the set name.

classmethod type_name() str[source]#

Returns its fullname.

OptParType#

class onnx_array_api.npx.npx_types.OptParType[source]#

Defines an optional parameter type.

Parameters:

dtype – parameter type

classmethod type_name() str[source]#

Returns its full name.

OptTensorType#

class onnx_array_api.npx.npx_types.OptTensorType[source]#

Defines an optional tensor type.

Parameters:

dtype – element type

ParType#

class onnx_array_api.npx.npx_types.ParType[source]#

Defines a parameter type.

Parameters:
  • dtype – parameter type

  • optional – is optional or not

classmethod onnx_type()[source]#

Returns the onnx corresponding type.

classmethod type_name() str[source]#

Returns its full name.

Scalar#

class onnx_array_api.npx.npx_types.Scalar(value: float | int | bool)[source]#

Defines a scalar.

SequenceType#

class onnx_array_api.npx.npx_types.SequenceType[source]#

Defines a sequence of tensors.

classmethod type_name() str[source]#

Returns its full name.

ShapeType#

class onnx_array_api.npx.npx_types.ShapeType(iterable=(), /)[source]#

Defines a shape type.

TensorType#

class onnx_array_api.npx.npx_types.TensorType[source]#

Used to annotate functions.

Parameters:
  • dtypes – tuple of ElemType

  • shape – tuple of integer or strings or None

  • name – name of the type

classmethod issuperset(tensor_type: type) bool[source]#

Tells if cls is a superset of tensor_type.

classmethod supports_dtype(dtype: DType) bool[source]#

Determines if the element type dtype is within dtypes.

classmethod type_name() str[source]#

Returns its full name.

TupleType#

class onnx_array_api.npx.npx_types.TupleType[source]#

Defines a sequence of tensors.

classmethod len()[source]#

Returns the number of types.

classmethod type_name() str[source]#

Returns its full name.

Shortcuts#

class onnx_array_api.npx.npx_types.Bool#
class onnx_array_api.npx.npx_types.BFloat16#
class onnx_array_api.npx.npx_types.Float16#
class onnx_array_api.npx.npx_types.Float32#
onnx_array_api.npx.npx_types.Float64#

alias of Float32

onnx_array_api.npx.npx_types.Int8#

alias of int8

onnx_array_api.npx.npx_types.Int16#

alias of int16

onnx_array_api.npx.npx_types.Int32#

alias of int32

onnx_array_api.npx.npx_types.Int64#

alias of int64

onnx_array_api.npx.npx_types.UInt8#

alias of uint8

onnx_array_api.npx.npx_types.UInt16#

alias of uint16

onnx_array_api.npx.npx_types.UInt32#

alias of uint32

onnx_array_api.npx.npx_types.UInt64#

alias of uint64