npx.npx_numpy_tensors#
EagerNumpyTensor#
JitNumpyTensor#
NumpyTensor#
- class onnx_array_api.npx.npx_numpy_tensors.NumpyTensor(tensor: ndarray)[source]#
Default backend based on
onnx_array_api.reference.ExtendedReferenceEvaluator()
.- Parameters:
input_names – input names
onx – onnx model
- class Evaluator(tensor_class: type, input_names: List[str], onx: ModelProto, f: Callable)[source]#
Wraps class
onnx_array_api.reference.ExtendedReferenceEvaluator
to have a signature closer to python function.- Parameters:
tensor_class – class tensor such as
NumpyTensor
input_names – input names
onx – onnx model
f – unused except in error messages
- run(*inputs: List[NumpyTensor]) List[NumpyTensor] [source]#
Executes the function.
- Parameters:
inputs – function inputs
- Returns:
outputs
- classmethod create_function(input_names: List[str], onx: ModelProto, f: Callable) Callable [source]#
Creates a python function calling the onnx backend used by this class.
- Parameters:
onx – onnx model
- Returns:
python function
- property dims#
Returns the dimensions of the tensor. First dimension is the batch dimension if the tensor has more than one dimension. It is always left undefined.
- classmethod get_ir_version(ir_version)[source]#
Updates the IR version. This method should be overloaded. By default, it returns ir_version.
- classmethod get_opsets(opsets)[source]#
Updates the opsets for a given backend. This method should be overloaded. By default, it returns opsets.
- property ndim#
Returns the number of dimensions (rank).
- property tensor_type: TensorType#
Returns the tensor type of this tensor.
- tensor_type_dims(name: str) TensorType [source]#
Returns the tensor type of this tensor. This property is used to define a key used to cache a jitted function. Same keys keys means same ONNX graph. Different keys usually means same ONNX graph but different input shapes.
- Parameters:
name – name of the constraint