OperationCapabilities class

Describes the capabilities and characteristics of a tensor operation.

This metadata helps pipeline optimizers understand operation behavior without executing them. Use this for:

  • In-place operation chaining
  • Memory allocation planning
  • Pipeline fusion opportunities
  • Framework compatibility checks

Example:

class MyOp extends TransformOp {
  @override
  OperationCapabilities get capabilities => const OperationCapabilities(
    supportsInPlace: true,
    preservesShape: true,
    pytorchEquivalent: 'torch.nn.ReLU',
    onnxOpType: 'Relu',
  );
}

Constructors

OperationCapabilities({bool supportsInPlace = false, bool requiresContiguous = false, bool preservesShape = true, bool modifiesDType = false, bool supportsBroadcast = false, Set<DType> supportedDTypes = const {DType.float32, DType.float64}, String? pytorchEquivalent, String? onnxOpType, int? onnxOpsetVersion})
Creates operation capabilities with the specified characteristics.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
modifiesDType bool
Whether the operation may change the data type.
final
onnxOpsetVersion int?
The minimum ONNX opset version required for this operation.
final
onnxOpType String?
The equivalent ONNX operator type, if applicable.
final
preservesShape bool
Whether the operation preserves the input shape.
final
pytorchEquivalent String?
The equivalent PyTorch operation name, if applicable.
final
requiresContiguous bool
Whether the operation requires contiguous memory layout.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedDTypes Set<DType>
The set of data types supported by this operation.
final
supportsBroadcast bool
Whether the operation supports broadcasting of input tensors.
final
supportsInPlace bool
Whether the operation can modify the input tensor in place.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultCapabilities → const OperationCapabilities
Default capabilities for operations that don't specify their own.