chore: import upstream snapshot with attribution
Lint / lint (push) Has been cancelled
Build Docs / Deploy Docs (push) Has been cancelled
Windows CI / Windows (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:23:58 +08:00
commit 770d92cb1f
694 changed files with 114634 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
"""Utilities shared across model definitions."""
from tvm import te
from tvm.relax.frontend.nn import Tensor, op
def index_last_token(x: Tensor) -> Tensor:
"""Select the last token while preserving the historical `index` TE op shape/name."""
def _index(x: te.Tensor):
b, s, d = x.shape
return te.compute((b, 1, d), lambda i, _, k: x[i, s - 1, k], name="index")
return op.tensor_expr_op(_index, name_hint="index", args=[x])