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(...).
Manifold-Constrained Hyper-Connections¶
tileops.sequence_modeling.MHCPreFwdOp
¶
The pre-layer half of Manifold-Constrained Hyper-Connections (mHC).
Reduces the width-expanded stream to the single tensor a layer consumes, and
returns the residual that MHCPostFwdOp mixes the layer output back into. The
expansion width is read from the shape of phi rather than passed in.
Layout: BSHD
__init__
¶
Build the op. Shapes and dtype are taken from the first call.
Parameters:
-
alpha_pre(float) –Manifest
params.alpha_pre, the pre-layer mixing weight. -
alpha_post(float) –Manifest
params.alpha_post, the post-layer mixing weight. -
alpha_res(float) –Manifest
params.alpha_res, the residual mixing weight. -
sinkhorn_repeat(int) –Manifest
params.sinkhorn_repeat, Sinkhorn iterations. -
sinkhorn_eps(float, default:0.02) –Manifest
params.sinkhorn_eps, Sinkhorn entropy scale. -
target(Target, default:None) –Which set of kernels serves this op — a target name,
BUILTINfor the in-tree kernels, orNoneto decide from the input device.
forward
¶
Run the op on the inputs the manifest declares.
Parameters:
-
phi(Tensor) –[n * c_x, n * n + 2 * n], dtypefloat32. -
x(Tensor) –[batch, n * c_x], dtypebfloat16. -
b(Tensor) –[n * n + 2 * n], dtypefloat32.
Returns:
-
Tensor–x_res,x_layer,h_post, as the manifest declares.
tileops.sequence_modeling.MHCPostFwdOp
¶
The post-layer half of Manifold-Constrained Hyper-Connections (mHC).
Mixes a layer's output into the residual MHCPreFwdOp set aside, restoring the width-expanded stream.
Layout: BSHD
__init__
¶
Build the op. Shapes and dtype are taken from the first call.
Parameters:
-
target(Target, default:None) –Which set of kernels serves this op — a target name,
BUILTINfor the in-tree kernels, orNoneto decide from the input device.
forward
¶
Run the op on the inputs the manifest declares.
Parameters:
-
x_layer_out(Tensor) –[batch, c_x], dtypebfloat16. -
h_post(Tensor) –[batch, n], dtypefloat32. -
x_res(Tensor) –[batch, n * c_x], dtypebfloat16.
Returns:
-
Tensor–x_out, as the manifest declares.