vortex_torch.indexer.scan¶
Classes
|
Segmented \(L_2\) normalization over the packed sequence axis. |
|
Segmented scaled softmax over the packed sequence axis. |
- class Softmax(dim=0, scale=1.0)[source]¶
Bases:
vOpSegmented scaled softmax over the packed sequence axis.
- Math:
The leading axis is a packed concatenation of \(B\) per-request segments \(\mathcal{I}_b\) (total length \(S = \sum_b S_b\)). For each segment and each channel \((d_0,d_1)\), softmax runs within the segment:
\[Y_{s,d_0,d_1} = \frac{\exp(\text{scale}\cdot X_{s,d_0,d_1})} {\sum_{s'\in\mathcal{I}_b}\exp(\text{scale}\cdot X_{s',d_0,d_1})}, \qquad s\in\mathcal{I}_b.\]- __init__:
Softmax(dim=0, scale=1.0)—dimmust be0(the packed S axis);scalemultiplies the logits before the exponential.- __call__:
y = op(x, ctx=ctx)—x[S, D_0, D_1]→ same shape.- Note:
RAGGEDonly.- Parameters:
- class Normalize(dim=0)[source]¶
Bases:
vOpSegmented \(L_2\) normalization over the packed sequence axis.
- Math:
The leading axis is a packed concatenation of \(B\) per-request segments \(\mathcal{I}_b\). For each segment and each channel \((d_0,d_1)\), the values are divided by their segment-local \(L_2\) norm:
\[Y_{s,d_0,d_1} = \frac{X_{s,d_0,d_1}} {\sqrt{\sum_{s'\in\mathcal{I}_b} X_{s',d_0,d_1}^2}}, \qquad s\in\mathcal{I}_b.\]- __init__:
Normalize(dim=0)—dimmust be0(the packed S axis).- __call__:
y = op(x, ctx=ctx)—x[S, D_0, D_1]→ same shape.- Note:
RAGGEDonly.- Parameters:
dim (int)
- class Conv1d(weight, dim=0, dtype=torch.bfloat16, device=None)[source]¶
Bases:
vOpSegmented depth-wise causal 1-D convolution over the packed sequence axis.
- Math:
The leading axis is a packed concatenation of \(B\) per-request segments. Within each segment, every channel \((d_0,d_1)\) is convolved by its own \(K\)-tap causal filter \(W\in\mathbb{R}^{K\times D_0\times D_1}\):
\[Y_{s,d_0,d_1} = \sum_{k=0}^{K-1} W_{k,d_0,d_1}\, X_{s-k,\,d_0,d_1},\]with \(X_{s-k}=0\) for \(s-k\) before the segment. The op runs only on the mid-range \([b_{\text{bos}},\,S_b-b_{\text{eos}})\) (
ctx.block_reserved_bos/block_reserved_eos); reserved BOS/EOS rows are neither read nor written.- __init__:
Conv1d(weight, dim=0, dtype=torch.bfloat16, device=None)—weightis a nested Python list of shape[K, D_0, D_1](kernel size \(K\) =len(weight));dimmust be0.- __call__:
y = op(x, ctx=ctx)—x[S, D_0, D_1]→ same shape;weight’s inner dims must match(D_0, D_1).- Note:
RAGGEDonly.- Parameters: