vortex_torch.abs.op

Classes

vOp()

Base class for defining virtual operators that support profiling and execution modes.

class vortex_torch.abs.op.vOp[source]

Bases: ABC

Base class for defining virtual operators that support profiling and execution modes.

This abstract base class provides a unified interface for defining virtual operators that have two main phases:

  • Profiling phase – used to pre-compute shapes, allocate buffers, or collect statistics.

  • Execution phase – performs the actual operator computation.

Subclasses must implement profile() and execute(). The __call__() method automatically dispatches between these modes based on the provided context.

abstractmethod profile(*args, ctx=None, **kwargs)[source]

Abstract method: profile.

Called during the profiling or preparation phase.

Typical use cases:
  • Allocate persistent output buffers.

  • Compute static shapes.

  • Collect performance statistics.

Subclasses must implement this method.

Parameters:
  • *args (Any) – Positional arguments.

  • ctx (ContextBase, optional) – The execution context.

  • **kwargs – Additional keyword arguments.

Returns:

The result of the profiling operation.

Return type:

Any

Raises:

NotImplementedError – If the subclass does not implement this method.

abstractmethod execute(*args, ctx=None, **kwargs)[source]

Abstract method: execute.

Called during the normal execution phase.

This method implements the actual operator logic. Subclasses must provide their own implementation.

Parameters:
  • *args (Any) – Positional arguments for the operation.

  • ctx (ContextBase, optional) – The execution context.

  • **kwargs – Additional keyword arguments.

Returns:

The result of the operator execution.

Return type:

Any

Raises:

NotImplementedError – If the subclass does not implement this method.