vortex_torch.indexer.elementwise_binary¶
Classes
|
Affine combination \(\alpha x + \beta y\) (an |
|
Binary elementwise op — combines two tensors pointwise (with broadcasting). |
|
Elementwise maximum (an |
|
Elementwise minimum (an |
|
Elementwise product (an |
- class Elementwise_Binary(alpha=1.0, beta=1.0)[source]¶
Bases:
vOpBinary elementwise op — combines two tensors pointwise (with broadcasting).
- Math:
- \[Z_{s,c,d} = g(X_{s,c,d},\, Y_{s,c,d};\, \alpha, \beta),\]
where \(g\) is fixed by the subclass (max / min / affine-sum / product / comparison) and the inner
(C, D)axes broadcast. - __init__:
Elementwise_Binary(alpha=1.0, beta=1.0)— scalar parameters used by some ops (e.g. the affine sum \(\alpha x + \beta y\)).- __call__:
z = op(x, y, ctx=ctx)—x/y[S, C, D](broadcast onC, D); output[S, max(C_x,C_y), max(D_x,D_y)].BATCHEDiff both inputs are, elseRAGGED.- Note:
use a concrete subclass —
Maximum,Minimum,Add,Multiply, or a comparison mask (WhereGreater,WhereEqual, …).- Parameters:
- class Maximum(alpha=1.0, beta=1.0)[source]¶
Bases:
Elementwise_BinaryElementwise maximum (an
Elementwise_Binary).
- class Minimum(alpha=1.0, beta=1.0)[source]¶
Bases:
Elementwise_BinaryElementwise minimum (an
Elementwise_Binary).
- class Add(alpha=1.0, beta=1.0)[source]¶
Bases:
Elementwise_BinaryAffine combination \(\alpha x + \beta y\) (an
Elementwise_Binary).
- class Multiply(alpha=1.0, beta=1.0)[source]¶
Bases:
Elementwise_BinaryElementwise product (an
Elementwise_Binary).
- class WhereEqual[source]¶
Bases:
Elementwise_BinaryComparison mask \(x = y\) (an
Elementwise_Binary).- Math:
- \[\begin{split}Z_{s,c,d} = \begin{cases} 0, & X_{s,c,d} = Y_{s,c,d}, \\ -\infty, & \text{otherwise}. \end{cases}\end{split}\]
- __init__:
WhereEqual()— no arguments.- Note:
additive mask, intended to gate a score tensor before
vortex_torch.indexer.Softmax/vortex_torch.indexer.topK().
- class WhereNotEqual[source]¶
Bases:
Elementwise_BinaryComparison mask \(x \ne y\) (an
Elementwise_Binary).- Math:
- \[\begin{split}Z_{s,c,d} = \begin{cases} 0, & X_{s,c,d} \ne Y_{s,c,d}, \\ -\infty, & \text{otherwise}. \end{cases}\end{split}\]
- __init__:
WhereNotEqual()— no arguments.
- class WhereGreater[source]¶
Bases:
Elementwise_BinaryComparison mask \(x > y\) (an
Elementwise_Binary).- Math:
- \[\begin{split}Z_{s,c,d} = \begin{cases} 0, & X_{s,c,d} > Y_{s,c,d}, \\ -\infty, & \text{otherwise}. \end{cases}\end{split}\]
- __init__:
WhereGreater()— no arguments.
- class WhereGreaterEqual[source]¶
Bases:
Elementwise_BinaryComparison mask \(x \ge y\) (an
Elementwise_Binary).- Math:
- \[\begin{split}Z_{s,c,d} = \begin{cases} 0, & X_{s,c,d} \ge Y_{s,c,d}, \\ -\infty, & \text{otherwise}. \end{cases}\end{split}\]
- __init__:
WhereGreaterEqual()— no arguments.
- class WhereLess[source]¶
Bases:
Elementwise_BinaryComparison mask \(x < y\) (an
Elementwise_Binary).- Math:
- \[\begin{split}Z_{s,c,d} = \begin{cases} 0, & X_{s,c,d} < Y_{s,c,d}, \\ -\infty, & \text{otherwise}. \end{cases}\end{split}\]
- __init__:
WhereLess()— no arguments.
- class WhereLessEqual[source]¶
Bases:
Elementwise_BinaryComparison mask \(x \le y\) (an
Elementwise_Binary).- Math:
- \[\begin{split}Z_{s,c,d} = \begin{cases} 0, & X_{s,c,d} \le Y_{s,c,d}, \\ -\infty, & \text{otherwise}. \end{cases}\end{split}\]
- __init__:
WhereLessEqual()— no arguments.