vortex_torch.abs.op¶
Classes
|
Base class for defining virtual operators that support profiling and execution modes. |
- class vOp[source]¶
Bases:
ABCBase 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().execute()is optional — ops that run only through the compiled codegen path may omit it; callingexecute()on such an op will raiseNotImplementedError. The__call__()method automatically dispatches between these modes based on the provided context.- schedule¶
Schedule type (e.g. W or S) that may be used by implementations.
- execute(*args, ctx=None, **kwargs)[source]¶
Optional: execute the operator at runtime.
Subclasses that participate in the runtime (eager) path should override this method. Subclasses that run only through the compiled (codegen) path may leave it unimplemented; in that case attempting to call
execute()raisesNotImplementedErrorwith a hint that this op is codegen-only.- 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, if implemented.
- Return type:
Any
- Raises:
NotImplementedError – If the subclass has not overridden it.