pub struct BackendSlot;Expand description
Generic Backend slot. Carries the ai.onnx v1 DSL catalog
(48 methods). Outputs are typed &TYPE_TENSOR_F32. The
BackendSubgraph carrier is compiler-emitted, not a DSL method.
Implementations§
Source§impl BackendSlot
impl BackendSlot
Sourcepub fn zeros(&self, g: &mut Graph, dims: Vec<i64>) -> Output
pub fn zeros(&self, g: &mut Graph, dims: Vec<i64>) -> Output
Zeros(dims) - zero-initialized tensor of given shape.
Sourcepub fn ones(&self, g: &mut Graph, dims: Vec<i64>) -> Output
pub fn ones(&self, g: &mut Graph, dims: Vec<i64>) -> Output
Ones(dims) - one-initialized tensor of given shape.
Sourcepub fn constant(&self, g: &mut Graph, value: TensorProto) -> Output
pub fn constant(&self, g: &mut Graph, value: TensorProto) -> Output
Constant(value) - embedded literal tensor.
Sourcepub fn matmul(&self, g: &mut Graph, a: Output, b: Output) -> Output
pub fn matmul(&self, g: &mut Graph, a: Output, b: Output) -> Output
MatMul - matrix multiplication (canonical example).
Sourcepub fn gemm(
&self,
g: &mut Graph,
a: Output,
b: Output,
c: Option<Output>,
alpha: f32,
beta: f32,
trans_a: bool,
trans_b: bool,
) -> Output
pub fn gemm( &self, g: &mut Graph, a: Output, b: Output, c: Option<Output>, alpha: f32, beta: f32, trans_a: bool, trans_b: bool, ) -> Output
Gemm - alpha * (a @ b) + beta * c with optional transpose.
Sourcepub fn dot(&self, g: &mut Graph, a: Output, b: Output) -> Output
pub fn dot(&self, g: &mut Graph, a: Output, b: Output) -> Output
Dot - dot product (reduces along last axis for higher rank).
Sourcepub fn softmax(&self, g: &mut Graph, t: Output, axis: i64) -> Output
pub fn softmax(&self, g: &mut Graph, t: Output, axis: i64) -> Output
Softmax(axis) - softmax along the given axis.
Sourcepub fn leaky_relu(&self, g: &mut Graph, t: Output, alpha: f32) -> Output
pub fn leaky_relu(&self, g: &mut Graph, t: Output, alpha: f32) -> Output
LeakyRelu(alpha) - x if x > 0 else alpha * x.
Sourcepub fn reshape(&self, g: &mut Graph, t: Output, dims: Vec<i64>) -> Output
pub fn reshape(&self, g: &mut Graph, t: Output, dims: Vec<i64>) -> Output
Reshape(dims) - reshape to given dims.
Sourcepub fn transpose(
&self,
g: &mut Graph,
t: Output,
perm: Option<Vec<i64>>,
) -> Output
pub fn transpose( &self, g: &mut Graph, t: Output, perm: Option<Vec<i64>>, ) -> Output
Transpose(perm) - None reverses all dims.
Sourcepub fn concat(&self, g: &mut Graph, tensors: Vec<Output>, axis: i64) -> Output
pub fn concat(&self, g: &mut Graph, tensors: Vec<Output>, axis: i64) -> Output
Concat(axis) - concatenate tensors along axis.
Sourcepub fn split(
&self,
g: &mut Graph,
t: Output,
axis: i64,
sizes: Vec<i64>,
) -> Vec<Output>
pub fn split( &self, g: &mut Graph, t: Output, axis: i64, sizes: Vec<i64>, ) -> Vec<Output>
Split(axis, sizes) - split into N parts. Returns one
Output per size.
Sourcepub fn slice(
&self,
g: &mut Graph,
t: Output,
starts: Vec<i64>,
ends: Vec<i64>,
axes: Option<Vec<i64>>,
steps: Option<Vec<i64>>,
) -> Output
pub fn slice( &self, g: &mut Graph, t: Output, starts: Vec<i64>, ends: Vec<i64>, axes: Option<Vec<i64>>, steps: Option<Vec<i64>>, ) -> Output
Slice(starts, ends, axes?, steps?) - NumPy-style slice.
Sourcepub fn squeeze(
&self,
g: &mut Graph,
t: Output,
axes: Option<Vec<i64>>,
) -> Output
pub fn squeeze( &self, g: &mut Graph, t: Output, axes: Option<Vec<i64>>, ) -> Output
Squeeze(axes?) - remove length-1 dimensions.
Sourcepub fn unsqueeze(&self, g: &mut Graph, t: Output, axes: Vec<i64>) -> Output
pub fn unsqueeze(&self, g: &mut Graph, t: Output, axes: Vec<i64>) -> Output
Unsqueeze(axes) - insert length-1 dimensions.
Sourcepub fn cast(&self, g: &mut Graph, t: Output, to_elem_type: i32) -> Output
pub fn cast(&self, g: &mut Graph, t: Output, to_elem_type: i32) -> Output
Cast(to) - cast to the given ONNX DataType enum value.
Sourcepub fn reduce_sum(
&self,
g: &mut Graph,
t: Output,
axes: Option<Vec<i64>>,
keepdims: bool,
) -> Output
pub fn reduce_sum( &self, g: &mut Graph, t: Output, axes: Option<Vec<i64>>, keepdims: bool, ) -> Output
ReduceSum(axes?, keepdims).
Sourcepub fn reduce_mean(
&self,
g: &mut Graph,
t: Output,
axes: Option<Vec<i64>>,
keepdims: bool,
) -> Output
pub fn reduce_mean( &self, g: &mut Graph, t: Output, axes: Option<Vec<i64>>, keepdims: bool, ) -> Output
ReduceMean(axes?, keepdims).
Sourcepub fn reduce_max(
&self,
g: &mut Graph,
t: Output,
axes: Option<Vec<i64>>,
keepdims: bool,
) -> Output
pub fn reduce_max( &self, g: &mut Graph, t: Output, axes: Option<Vec<i64>>, keepdims: bool, ) -> Output
ReduceMax(axes?, keepdims).
Sourcepub fn reduce_min(
&self,
g: &mut Graph,
t: Output,
axes: Option<Vec<i64>>,
keepdims: bool,
) -> Output
pub fn reduce_min( &self, g: &mut Graph, t: Output, axes: Option<Vec<i64>>, keepdims: bool, ) -> Output
ReduceMin(axes?, keepdims).
Sourcepub fn equal(&self, g: &mut Graph, a: Output, b: Output) -> Output
pub fn equal(&self, g: &mut Graph, a: Output, b: Output) -> Output
Equal - element-wise a == b (bool tensor).
Sourcepub fn greater(&self, g: &mut Graph, a: Output, b: Output) -> Output
pub fn greater(&self, g: &mut Graph, a: Output, b: Output) -> Output
Greater - element-wise a > b (bool tensor).
Sourcepub fn less(&self, g: &mut Graph, a: Output, b: Output) -> Output
pub fn less(&self, g: &mut Graph, a: Output, b: Output) -> Output
Less - element-wise a < b (bool tensor).
Sourcepub fn batch_normalization(
&self,
g: &mut Graph,
input: Output,
scale: Output,
bias: Output,
mean: Output,
variance: Output,
epsilon: f32,
momentum: f32,
) -> Output
pub fn batch_normalization( &self, g: &mut Graph, input: Output, scale: Output, bias: Output, mean: Output, variance: Output, epsilon: f32, momentum: f32, ) -> Output
BatchNormalization(epsilon, momentum).
Sourcepub fn layer_normalization(
&self,
g: &mut Graph,
input: Output,
scale: Output,
bias: Option<Output>,
axis: i64,
epsilon: f32,
) -> Output
pub fn layer_normalization( &self, g: &mut Graph, input: Output, scale: Output, bias: Option<Output>, axis: i64, epsilon: f32, ) -> Output
LayerNormalization(axis, epsilon).
Sourcepub fn conv(
&self,
g: &mut Graph,
input: Output,
weight: Output,
bias: Option<Output>,
kernel_shape: Vec<i64>,
strides: Vec<i64>,
pads: Vec<i64>,
dilations: Vec<i64>,
group: i64,
) -> Output
pub fn conv( &self, g: &mut Graph, input: Output, weight: Output, bias: Option<Output>, kernel_shape: Vec<i64>, strides: Vec<i64>, pads: Vec<i64>, dilations: Vec<i64>, group: i64, ) -> Output
Conv(kernel_shape, strides, pads, dilations, group).
Sourcepub fn max_pool(
&self,
g: &mut Graph,
input: Output,
kernel_shape: Vec<i64>,
strides: Vec<i64>,
pads: Vec<i64>,
) -> Output
pub fn max_pool( &self, g: &mut Graph, input: Output, kernel_shape: Vec<i64>, strides: Vec<i64>, pads: Vec<i64>, ) -> Output
MaxPool(kernel_shape, strides, pads).
Sourcepub fn average_pool(
&self,
g: &mut Graph,
input: Output,
kernel_shape: Vec<i64>,
strides: Vec<i64>,
pads: Vec<i64>,
count_include_pad: bool,
) -> Output
pub fn average_pool( &self, g: &mut Graph, input: Output, kernel_shape: Vec<i64>, strides: Vec<i64>, pads: Vec<i64>, count_include_pad: bool, ) -> Output
AveragePool(kernel_shape, strides, pads, count_include_pad).
Sourcepub fn global_average_pool(&self, g: &mut Graph, input: Output) -> Output
pub fn global_average_pool(&self, g: &mut Graph, input: Output) -> Output
GlobalAveragePool - collapse spatial dims to length 1.
Sourcepub fn gather(
&self,
g: &mut Graph,
data: Output,
indices: Output,
axis: i64,
) -> Output
pub fn gather( &self, g: &mut Graph, data: Output, indices: Output, axis: i64, ) -> Output
Gather(axis).
Sourcepub fn scatter(
&self,
g: &mut Graph,
data: Output,
indices: Output,
updates: Output,
axis: i64,
) -> Output
pub fn scatter( &self, g: &mut Graph, data: Output, indices: Output, updates: Output, axis: i64, ) -> Output
Scatter(axis).
Sourcepub fn if_op(
&self,
g: &mut Graph,
cond: Output,
then_branch: GraphProto,
else_branch: GraphProto,
n_outputs: usize,
) -> Vec<Output>
pub fn if_op( &self, g: &mut Graph, cond: Output, then_branch: GraphProto, else_branch: GraphProto, n_outputs: usize, ) -> Vec<Output>
If(then_branch, else_branch) - both branches are sub-graphs
carried on AttributeProto.g per IR_AND_DSL.md Part 2 line 80.
Returns one Output per branch output.
Trait Implementations§
Source§impl Clone for BackendSlot
impl Clone for BackendSlot
Source§fn clone(&self) -> BackendSlot
fn clone(&self) -> BackendSlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more