pub struct UnaryParamDescriptor<const N: usize> {
pub kind: UnaryKind,
pub shape: [i32; N],
pub element: ElementKind,
pub params: [f32; 2],
}Expand description
Descriptor for a parameterized unary elementwise op.
shape is both the input and the output shape. element must match
T::KIND at select time. params carries op-specific scalars —
the layout is fixed by the op’s kind:
| Op | params[0] | params[1] |
|---|---|---|
Threshold | t | v |
PowI | n as f32 | unused |
We chose [f32; 2] rather than separate t: f32, v: f32 fields so
the descriptor shape doesn’t shift as more 1- or 2-param ops join
(LeakyRelu / ELU / Hardshrink / Softshrink could all re-emit here
with params[0] = α or params[0] = λ and params[1] ignored).
Fields§
§kind: UnaryKindWhich parameterized unary op to apply.
shape: [i32; N]Tensor shape — input and output share it.
element: ElementKindPrimary element type. Must match the type parameter T of the
containing plan.
params: [f32; 2]Op-specific scalar parameters. Slot semantics depend on kind:
for Threshold it’s [t, v]. Parameters are always f32 on the
FFI; integer / f64 kernels widen the param losslessly at the
kernel boundary, and half-precision kernels compare in f32.
Trait Implementations§
Source§impl<const N: usize> Clone for UnaryParamDescriptor<N>
impl<const N: usize> Clone for UnaryParamDescriptor<N>
Source§fn clone(&self) -> UnaryParamDescriptor<N>
fn clone(&self) -> UnaryParamDescriptor<N>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more