pub enum OpSpec {
ConvFwd {
x: i64,
w: i64,
y: i64,
spatial_dims: usize,
pre_padding: Vec<i64>,
post_padding: Vec<i64>,
stride: Vec<i64>,
dilation: Vec<i64>,
compute_dtype: DtypeTag,
alpha: f64,
beta: f64,
},
ConvBwdData {
dy: i64,
w: i64,
dx: i64,
spatial_dims: usize,
pre_padding: Vec<i64>,
post_padding: Vec<i64>,
stride: Vec<i64>,
dilation: Vec<i64>,
compute_dtype: DtypeTag,
alpha: f64,
beta: f64,
},
ConvBwdFilter {
x: i64,
dy: i64,
dw: i64,
spatial_dims: usize,
pre_padding: Vec<i64>,
post_padding: Vec<i64>,
stride: Vec<i64>,
dilation: Vec<i64>,
compute_dtype: DtypeTag,
alpha: f64,
beta: f64,
},
Pointwise {
mode: PointwiseMode,
x: i64,
b: Option<i64>,
y: i64,
compute_dtype: DtypeTag,
alpha1: f64,
alpha2: f64,
},
PoolFwd {
kind: PoolKind,
x: i64,
y: i64,
window: Vec<i64>,
pre_padding: Vec<i64>,
post_padding: Vec<i64>,
stride: Vec<i64>,
compute_dtype: DtypeTag,
},
PoolBwd {
kind: PoolKind,
dy: i64,
x: i64,
y: i64,
dx: i64,
window: Vec<i64>,
pre_padding: Vec<i64>,
post_padding: Vec<i64>,
stride: Vec<i64>,
compute_dtype: DtypeTag,
},
NormFwd {
mode: NormMode,
phase: NormPhase,
x: i64,
scale: i64,
bias: i64,
mean: Option<i64>,
var: Option<i64>,
y: i64,
compute_dtype: DtypeTag,
epsilon: f64,
exp_avg_factor: f64,
},
NormBwd {
mode: NormMode,
x: i64,
dy: i64,
scale: i64,
mean: i64,
var: i64,
dx: i64,
dscale: i64,
dbias: i64,
compute_dtype: DtypeTag,
},
Matmul {
a: i64,
b: i64,
c: i64,
compute_dtype: DtypeTag,
},
Reduce {
op: ReduceOp,
x: i64,
y: i64,
compute_dtype: DtypeTag,
},
Reshape {
x: i64,
y: i64,
},
}Expand description
One op in a backend graph. Each OpSpec references TensorSpecs
by their uid; the actual TensorSpec values live on the parent
OperationGraphSpec.
Hash is implemented manually so that float fields participate via
their bit-pattern (so two specs with alpha = 0.0 hash equal even
though f64: !Eq).
Variants§
ConvFwd
Convolution forward: y = conv(x, w).
Fields
ConvBwdData
Convolution backward data: dx = conv_bwd_data(w, dy).
Fields
ConvBwdFilter
Convolution backward filter: dw = conv_bwd_filter(x, dy).
Fields
Pointwise
Pointwise op (activation, scale, bias-add, …).
Fields
§
mode: PointwiseModePoolFwd
Pooling/resample forward.
Fields
PoolBwd
Pooling/resample backward.
Fields
NormFwd
Normalisation forward (batch / layer / instance / group).
Fields
NormBwd
Normalisation backward.
Fields
Matmul
Matmul (2D) — used by attention fusion.
Reduce
Reduction (sum / max / min / mul / norm).
Reshape
Reshape (no-copy view change).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OpSpec
impl RefUnwindSafe for OpSpec
impl Send for OpSpec
impl Sync for OpSpec
impl Unpin for OpSpec
impl UnsafeUnpin for OpSpec
impl UnwindSafe for OpSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more