onnx_diagnostic.reference.torch_ops¶
modules
- onnx_diagnostic.reference.torch_ops.access_ops
- onnx_diagnostic.reference.torch_ops.binary_ops
- onnx_diagnostic.reference.torch_ops.controlflow_ops
- onnx_diagnostic.reference.torch_ops.generator_ops
- onnx_diagnostic.reference.torch_ops.nn_ops
- onnx_diagnostic.reference.torch_ops.other_ops
- onnx_diagnostic.reference.torch_ops.reduce_ops
- onnx_diagnostic.reference.torch_ops.sequence_ops
- onnx_diagnostic.reference.torch_ops.shape_ops
- onnx_diagnostic.reference.torch_ops.unary_ops
OpRun¶
- class onnx_diagnostic.reference.torch_ops.OpRun(node: NodeProto, version: int | None = None)[source][source]¶
Main class. Every kernel should inherit from it. It does not copy the proto.
- classmethod device_dependent() bool [source][source]¶
Returns True if the kernel needs a device to be efficiently initialized.
- get_attribute_float(node: NodeProto, name: str, default_value: float | None = None) float | None [source][source]¶
Returns an attribute as an int.
- Parameters:
node – NodeProto
name – name
default_value – default_value
- Returns:
value
- get_attribute_int(node: NodeProto, name: str, default_value: int | None = None) int | None [source][source]¶
Returns an attribute as an int.
- Parameters:
node – NodeProto
name – name
default_value – default_value
- Returns:
value
- get_attribute_ints(node: NodeProto, name: str, default_value: Tuple[int, ...] | None = None) Tuple[int, ...] | None [source][source]¶
Returns an attribute as a tuple of ints.
- Parameters:
node – NodeProto
name – name
default_value – default_value
- Returns:
value
- get_attribute_string(node: NodeProto, name: str, default_value: str | None = None) str | None [source][source]¶
Returns an attribute as a tuple of ints.
- Parameters:
node – NodeProto
name – name
default_value – default_value
- Returns:
value
- get_attribute_tensor(node: NodeProto, name: str) Tensor | None [source][source]¶
Returns an attribute as a torch tensor.
- Parameters:
node – NodeProto
name – name
default_value – default_value
- Returns:
value
- run(*args: OpRunValue | None) OpRunValue | Tuple[OpRunValue | None, ...] [source][source]¶
Kernel implementation.
OpRunTensor¶
- class onnx_diagnostic.reference.torch_ops.OpRunTensor(tensor, is_constant: bool = False, may_cpu: bool = False)[source][source]¶
Wrapper around a tensor.
- Parameters:
tensor – torch.Tensor
is_constant – is it a constant
may_cpu – change the device the tensor is if more appropriate
- copy() OpRunTensor [source][source]¶
Shallow copy.
- property device¶
Returns the device.
- property dtype¶
- property shape¶
- to(to: Any) OpRunTensor [source][source]¶
Changes the device.
OpRunValue¶
OpRunSequence¶
- class onnx_diagnostic.reference.torch_ops.OpRunSequence(sequence: List[Tensor] | None = None, dtype: dtype = torch.float32)[source][source]¶
Defines a sequence.
- copy() OpRunSequence [source][source]¶
Shallow copy.
- property dtype¶
- insert_at(tensor: Tensor, position: OpRunTensor | None = None) OpRunSequence [source][source]¶
Inserts a value at a given position.
OpRunFunction¶
- class onnx_diagnostic.reference.torch_ops.OpRunFunction(runtime: onnx_diagnostic.reference.TorchOnnxEvaluator, node: NodeProto, version: int | None = None)[source][source]¶
Defines a kernel based on a local functions.
- run(*args: OpRunValue | None) OpRunValue | Tuple[OpRunValue | None, ...] [source][source]¶
Kernel implementation.