MHC Operators¶
Every op on this page is used the same way: construct it once, then call it. The
constructor takes what the kernel is compiled with; the call takes the tensors.
Both are documented under each op — __init__ and forward, where forward is
what runs when you call op(...).
Multi-head compression¶
tileops.ops.sequence_modeling.mhc.MHCPreFwdOp
¶
Layout: BSHD
__init__
¶
Build the op. Shapes and dtype are taken from the first call.
Parameters:
-
kernel_map(Optional[Dict[str, Kernel]], default:None) –Optional kernel override dict.
-
tune(bool, default:False) –Whether to autotune, applied when a kernel is first built.
forward
¶
Run the op on the inputs the manifest declares.
Parameters:
-
phi(Tensor) –Input tensor, dtype
float32. -
x(Tensor) –Input tensor, dtype
bfloat16. -
b(Tensor) –Input tensor, dtype
float32.
Returns:
-
Tensor–x_res,x_layer, as the manifest declares.
tileops.ops.sequence_modeling.mhc.MHCPostFwdOp
¶
Layout: BSHD
__init__
¶
Build the op. Shapes and dtype are taken from the first call.
Parameters:
-
kernel_map(Optional[Dict[str, Kernel]], default:None) –Optional kernel override dict.
-
tune(bool, default:False) –Whether to autotune, applied when a kernel is first built.
forward
¶
Run the op on the inputs the manifest declares.
Parameters:
-
x_layer_out(Tensor) –Input tensor, dtype
bfloat16. -
h_post(Tensor) –Input tensor, dtype
float32. -
x_res(Tensor) –Input tensor, dtype
bfloat16.
Returns:
-
Tensor–x_out, as the manifest declares.