ttnn.generic_op
- ttnn.generic_op(io_tensors: List[ttnn.Tensor], program_descriptor: ttnn.ProgramDescriptor or ttnn.MeshProgramDescriptor) ttnn.Tensor
-
Executes a custom operation with user-defined kernels on the device.
The generic_op provides a flexible interface for constructing and executing custom operations on device hardware. It allows specifying custom compute kernels, data movement, and control flow.
- Parameters:
-
io_tensors (List[ttnn.Tensor]) – List of input tensors and output tensor(s). Output tensor(s) must be pre-allocated and included as the last element(s) in the list.
program_descriptor (ttnn.ProgramDescriptor or ttnn.MeshProgramDescriptor) – Descriptor containing kernel specifications, computational buffer configurations, semaphores, and other execution parameters. Use ProgramDescriptor for SPMD mode (same program on all devices) or MeshProgramDescriptor for explicit per-device control.
- Returns:
-
ttnn.Tensor – Handle to the output tensor.
Example
Refer to tests/ttnn/unit_tests/operations/debug/test_generic_op.py for usage examples