Op

Trait Op 

Source
pub trait Op {
    type Output;

Show 33 methods // Provided methods fn abnormal_softmax(self, temperature: f32) -> AbnormalSoftmax<Self> where Self: Sized, AbnormalSoftmax<Self>: Op { ... } fn abs(self) -> Abs<Self> where Self: Sized, Abs<Self>: Op { ... } fn acc_q(self, gamma: f32) -> AccQ<Self> where AccQ<Self>: Op, Self: Sized { ... } fn cat(self, dim: i32) -> Cat<Self> where Cat<Self>: Op, Self: Sized { ... } fn chain<B>(self, b: B) -> Sequential<(Self, B)> where Self: Sized, Sequential<(Self, B)>: Op { ... } fn cross_entropy(self, temperature: f32) -> CrossEntropy<Self> where CrossEntropy<Self>: Op, Self: Sized { ... } fn duplicate(self) -> Duplicate<Self> where Duplicate<Self>: Op, Self: Sized { ... } fn fix_type<Z>(self) -> SetType<Self, Z, Z> where Self: AI<Z, Z> + Sized { ... } fn flatten<R: Clone>(self, args: R) -> Flatten<Self, R> where Flatten<Self, R>: Op, Self: Sized { ... } fn forward_fixed<Z>(&self, input: Z) -> Z where Self: AI<Z, Z> + Sized { ... } fn forward_fixed_mut<Z>(&mut self, input: Z) -> Z where Self: AI<Z, Z> + Sized { ... } fn forward_typed<W, Z>(&self, input: W) -> Z where Self: AI<W, Z> + Sized { ... } fn forward_typed_mut<W, Z>(&mut self, input: W) -> Z where Self: AI<W, Z> + Sized { ... } fn infer_autoregressive<X, Y>(self, input: X) -> Autoregression<Self, Y> where Self: AI<X, Y> + AI<Y, Y> + Sized, Y: Clone { ... } fn log_softmax(self, temperature: f32) -> LogSoftmax<Self> where Self: Sized, LogSoftmax<Self>: Op { ... } fn map<B>(self, b: B) -> Map<Sequential<(Self, B)>> where Map<Sequential<(Self, B)>>: Op, Self: Sized, Sequential<(Self, B)>: Op { ... } fn mean(self) -> Mean<Self> where Mean<Self>: Op, Self: Sized { ... } fn optional(self) -> Option<Self> where Self: Sized { ... } fn reshape<R: Clone>(self, args: R) -> Reshape<Self, R> where Reshape<Self, R>: Op, Self: Sized { ... } fn residual(self) -> Residual<Self> where Residual<Self>: Op, Self: Sized { ... } fn separately(self) -> Zip<Self> where Self: Sized, Zip<Self>: Op { ... } fn sequential(self) -> Sequential<Self> where Self: Sized, Sequential<Self>: Op { ... } fn set_type<W, Z>(self) -> SetType<Self, W, Z> where Self: AI<W, Z> + Sized { ... } fn soft_choose(self, temperature: f32) -> Choose<Self> where Self: Sized, Choose<Self>: Op { ... } fn softmax(self, temperature: f32) -> Softmax<Self> where Self: Sized, Softmax<Self>: Op { ... } fn squared_error(self) -> SquaredError<Self> where SquaredError<Self>: Op, Self: Sized { ... } fn squeeze(self, dim: i32) -> Squeeze<Self> where Squeeze<Self>: Op, Self: Sized { ... } fn stack(self, dim: i32) -> Stack<Self> where Stack<Self>: Op, Self: Sized { ... } fn to_each(self) -> Map<Self> where Map<Self>: Op, Self: Sized { ... } fn unsqueeze(self, dim: i32) -> Unsqueeze<Self> where Unsqueeze<Self>: Op, Self: Sized { ... } fn sum(self) -> Sum<Self> where Sum<Self>: Op, Self: Sized { ... } fn wrap_inner(self) -> Inner<Self> where Self: Sized { ... } fn zip<B>(self, b: B) -> Zip<(Self, B)> where Self: Sized, Zip<(Self, B)>: Op { ... }
}
Expand description

composition trait

Required Associated Types§

Source

type Output

suggested output type to help with composition coherence. Ideally, Self should implement AI<X,Self::Output> for some X

Provided Methods§

Source

fn abnormal_softmax(self, temperature: f32) -> AbnormalSoftmax<Self>
where Self: Sized, AbnormalSoftmax<Self>: Op,

wraps with a softmax operation

Source

fn abs(self) -> Abs<Self>
where Self: Sized, Abs<Self>: Op,

wraps with an absolute value operation

Source

fn acc_q(self, gamma: f32) -> AccQ<Self>
where AccQ<Self>: Op, Self: Sized,

wraps with a accq operation

Source

fn cat(self, dim: i32) -> Cat<Self>
where Cat<Self>: Op, Self: Sized,

wraps with a cat operation

Source

fn chain<B>(self, b: B) -> Sequential<(Self, B)>
where Self: Sized, Sequential<(Self, B)>: Op,

sequences with another ai operation

Source

fn cross_entropy(self, temperature: f32) -> CrossEntropy<Self>
where CrossEntropy<Self>: Op, Self: Sized,

wraps with a cross entropy operation. If temperature is a number it will be used to apply softmax to the logits before computing entropy with the target. if the input will already be a probability distribution instead of logits, put NaN temperature

Source

fn duplicate(self) -> Duplicate<Self>
where Duplicate<Self>: Op, Self: Sized,

wraps with a duplicate operation

Source

fn fix_type<Z>(self) -> SetType<Self, Z, Z>
where Self: AI<Z, Z> + Sized,

set type but with the same input and output

Source

fn flatten<R: Clone>(self, args: R) -> Flatten<Self, R>
where Flatten<Self, R>: Op, Self: Sized,

wraps with a flatten layer

Source

fn forward_fixed<Z>(&self, input: Z) -> Z
where Self: AI<Z, Z> + Sized,

applies to the input

Source

fn forward_fixed_mut<Z>(&mut self, input: Z) -> Z
where Self: AI<Z, Z> + Sized,

applies to the input

Source

fn forward_typed<W, Z>(&self, input: W) -> Z
where Self: AI<W, Z> + Sized,

applies to the input

Source

fn forward_typed_mut<W, Z>(&mut self, input: W) -> Z
where Self: AI<W, Z> + Sized,

applies to the input, possibly updating internal caches

Source

fn infer_autoregressive<X, Y>(self, input: X) -> Autoregression<Self, Y>
where Self: AI<X, Y> + AI<Y, Y> + Sized, Y: Clone,

creates an autoregressive inference

Source

fn log_softmax(self, temperature: f32) -> LogSoftmax<Self>
where Self: Sized, LogSoftmax<Self>: Op,

wraps with a softmax operation

Source

fn map<B>(self, b: B) -> Map<Sequential<(Self, B)>>
where Map<Sequential<(Self, B)>>: Op, Self: Sized, Sequential<(Self, B)>: Op,

applies the operation to every output

Source

fn mean(self) -> Mean<Self>
where Mean<Self>: Op, Self: Sized,

wraps with a mean operation

Source

fn optional(self) -> Option<Self>
where Self: Sized,

creates an optional operation

Source

fn reshape<R: Clone>(self, args: R) -> Reshape<Self, R>
where Reshape<Self, R>: Op, Self: Sized,

wraps with a reshape layer

Source

fn residual(self) -> Residual<Self>
where Residual<Self>: Op, Self: Sized,

wraps in a residual layer

Source

fn separately(self) -> Zip<Self>
where Self: Sized, Zip<Self>: Op,

produces a zip module

Source

fn sequential(self) -> Sequential<Self>
where Self: Sized, Sequential<Self>: Op,

produces a sequential module

Source

fn set_type<W, Z>(self) -> SetType<Self, W, Z>
where Self: AI<W, Z> + Sized,

sets the input output types

Source

fn soft_choose(self, temperature: f32) -> Choose<Self>
where Self: Sized, Choose<Self>: Op,

wraps with a choose operation

Source

fn softmax(self, temperature: f32) -> Softmax<Self>
where Self: Sized, Softmax<Self>: Op,

wraps with a softmax operation

Source

fn squared_error(self) -> SquaredError<Self>
where SquaredError<Self>: Op, Self: Sized,

wraps with a mse operation

Source

fn squeeze(self, dim: i32) -> Squeeze<Self>
where Squeeze<Self>: Op, Self: Sized,

wraps with a squeeze operation

Source

fn stack(self, dim: i32) -> Stack<Self>
where Stack<Self>: Op, Self: Sized,

wraps with a stack operation

Source

fn to_each(self) -> Map<Self>
where Map<Self>: Op, Self: Sized,

wraps with a map operation

Source

fn unsqueeze(self, dim: i32) -> Unsqueeze<Self>
where Unsqueeze<Self>: Op, Self: Sized,

wraps with a unsqueeze operation

Source

fn sum(self) -> Sum<Self>
where Sum<Self>: Op, Self: Sized,

wraps with a sum operation

Source

fn wrap_inner(self) -> Inner<Self>
where Self: Sized,

wraps the inner value so it can be unwrapped with unwrap inner

Source

fn zip<B>(self, b: B) -> Zip<(Self, B)>
where Self: Sized, Zip<(Self, B)>: Op,

zips with another ai operation

Implementations on Foreign Types§

Source§

impl Op for ()

Source§

impl<A> Op for [A]

Source§

impl<A> Op for Vec<A>

Source§

impl<A: AI<X, X> + Op<Output = X>, X> Op for Option<A>

Source§

impl<A: Op, B: Op> Op for (A, B)

Source§

impl<A: Op, B: Op, C: Op> Op for (A, B, C)

Source§

impl<A: Op, B: Op, C: Op, D: Op> Op for (A, B, C, D)

Source§

impl<A: Op, B: Op, C: Op, D: Op, E: Op> Op for (A, B, C, D, E)

Source§

impl<A: Op, B: Op, C: Op, D: Op, E: Op, F: Op> Op for (A, B, C, D, E, F)

Source§

impl<A: Op, B: Op, C: Op, D: Op, E: Op, F: Op, G: Op> Op for (A, B, C, D, E, F, G)

Source§

impl<A: Op, B: Op, C: Op, D: Op, E: Op, F: Op, G: Op, H: Op> Op for (A, B, C, D, E, F, G, H)

Source§

impl<A: ?Sized + Op<Output = Y>, Y> Op for &A

Source§

impl<A: ?Sized + Op<Output = Y>, Y> Op for &mut A

Implementors§

Source§

impl Op for AbsLayer

Source§

impl Op for AddLayer

Source§

impl Op for MeanLayer

Source§

impl Op for MulLayer

Source§

impl Op for NegLayer

Source§

impl Op for SquaredErrorLayer

Source§

impl Op for SumLayer

Source§

impl Op for AccQLayer

Source§

impl Op for AbnormalSoftmaxLayer

Source§

impl Op for ChooseLayer

Source§

impl Op for CrossEntropyLayer

Source§

impl Op for LogSoftmaxLayer

Source§

impl Op for SoftmaxLayer

Source§

impl Op for CatLayer

Source§

impl Op for SqueezeLayer

Source§

impl Op for StackLayer

Source§

impl Op for UnsqueezeLayer

Source§

impl Op for ClassificationLayer

Source§

impl Op for RegressionLayer

Source§

impl<A: AI<X, X> + Op<Output = X>, X> Op for Sequential<&[A]>

Source§

impl<A: AI<X, X> + Op<Output = X>, X> Op for Sequential<&mut [A]>

Source§

impl<A: AI<X, X> + Op<Output = X>, X> Op for Sequential<Vec<A>>

Source§

impl<A: AI<X, Y>, X, Y> Op for SetType<A, X, Y>

Source§

impl<A: Op> Op for Inner<A>

Source§

type Output = <A as Op>::Output

Source§

impl<A: Op<Output = Vec<Y>>, Y> Op for Unvec<A>

Source§

impl<A: Op<Output = S>, B: AI<S, T> + Op<Output = T>, C: AI<T, U> + Op<Output = U>, D: AI<U, V> + Op<Output = V>, E: AI<V, W> + Op<Output = W>, F: AI<W, X> + Op<Output = X>, G: AI<Y, Z> + Op<Output = Y>, H: AI<Y, Z> + Op<Output = Z>, S, T, U, V, W, X, Y, Z> Op for Sequential<(A, B, C, D, E, F, G, H)>

Source§

impl<A: Op<Output = S>, S, B: Op<Output = T>, T, C: Op<Output = U>, U, D: Op<Output = V>, V, E: Op<Output = W>, W, F: Op<Output = X>, X, G: Op<Output = Y>, Y, H: Op<Output = Z>, Z> Op for Zip<(A, B, C, D, E, F, G, H)>

Source§

impl<A: Op<Output = T>, B: AI<T, U> + Op<Output = U>, C: AI<U, V> + Op<Output = V>, D: AI<V, W> + Op<Output = W>, E: AI<W, X> + Op<Output = X>, F: AI<Y, Z> + Op<Output = Y>, G: AI<Y, Z> + Op<Output = Z>, T, U, V, W, X, Y, Z> Op for Sequential<(A, B, C, D, E, F, G)>

Source§

impl<A: Op<Output = T>, T, B: Op<Output = U>, U, C: Op<Output = V>, V, D: Op<Output = W>, W, E: Op<Output = X>, X, F: Op<Output = Y>, Y, G: Op<Output = Z>, Z> Op for Zip<(A, B, C, D, E, F, G)>

Source§

impl<A: Op<Output = U>, B: AI<U, V> + Op<Output = V>, C: AI<V, W> + Op<Output = W>, D: AI<W, X> + Op<Output = X>, E: AI<Y, Z> + Op<Output = Y>, F: AI<Y, Z> + Op<Output = Z>, U, V, W, X, Y, Z> Op for Sequential<(A, B, C, D, E, F)>

Source§

impl<A: Op<Output = U>, U, B: Op<Output = V>, V, C: Op<Output = W>, W, D: Op<Output = X>, X, E: Op<Output = Y>, Y, F: Op<Output = Z>, Z> Op for Zip<(A, B, C, D, E, F)>

Source§

impl<A: Op<Output = V>, B: AI<V, W> + Op<Output = W>, C: AI<W, X> + Op<Output = X>, D: AI<Y, Z> + Op<Output = Y>, E: AI<Y, Z> + Op<Output = Z>, V, W, X, Y, Z> Op for Sequential<(A, B, C, D, E)>

Source§

impl<A: Op<Output = V>, V, B: Op<Output = W>, W, C: Op<Output = X>, X, D: Op<Output = Y>, Y, E: Op<Output = Z>, Z> Op for Zip<(A, B, C, D, E)>

Source§

impl<A: Op<Output = W>, B: AI<W, X> + Op<Output = X>, C: AI<Y, Z> + Op<Output = Y>, D: AI<Y, Z> + Op<Output = Z>, W, X, Y, Z> Op for Sequential<(A, B, C, D)>

Source§

impl<A: Op<Output = W>, W, B: Op<Output = X>, X, C: Op<Output = Y>, Y, D: Op<Output = Z>, Z> Op for Zip<(A, B, C, D)>

Source§

impl<A: Op<Output = X>, B: AI<Y, Z> + Op<Output = Y>, C: AI<Y, Z> + Op<Output = Z>, X, Y, Z> Op for Sequential<(A, B, C)>

Source§

impl<A: Op<Output = X>, X, B: Op<Output = Y>, Y, C: Op<Output = Z>, Z> Op for Zip<(A, B, C)>

Source§

impl<A: Op<Output = Y> + Wrappable, Y> Op for Classification<A>

Source§

impl<A: Op<Output = Y> + Wrappable, Y> Op for Regression<A>

Source§

impl<A: Op<Output = Y>, B: AI<Y, Z> + Op<Output = Z>, Y, Z> Op for Sequential<(A, B)>

Source§

impl<A: Op<Output = Y>, R: Clone, Y: Flatten<R, Output = Z>, Z> Op for Flatten<A, R>
where FlattenLayer<R>: AI<Y, Z>,

Source§

impl<A: Op<Output = Y>, R: Clone, Y: Reshape<R, Output = Z>, Z> Op for Reshape<A, R>
where ReshapeLayer<R>: AI<Y, Z>,

Source§

impl<A: Op<Output = Y>, Y> Op for Abs<A>
where AbsLayer: AI<Y, Y>,

Source§

impl<A: Op<Output = Y>, Y> Op for Add<A>
where AddLayer: AI<(Y, Y), Y>,

Source§

impl<A: Op<Output = Y>, Y> Op for Mean<A>
where MeanLayer: AI<Y, f32>,

Source§

impl<A: Op<Output = Y>, Y> Op for Mul<A>
where MulLayer: AI<(Y, Y), Y>,

Source§

impl<A: Op<Output = Y>, Y> Op for Neg<A>
where NegLayer: AI<Y, Y>,

Source§

impl<A: Op<Output = Y>, Y> Op for SquaredError<A>

Source§

impl<A: Op<Output = Y>, Y> Op for Sum<A>
where SumLayer: AI<Y, f32>,

Source§

impl<A: Op<Output = Y>, Y> Op for AccQ<A>
where AccQLayer: AI<Y, Y>,

Source§

impl<A: Op<Output = Y>, Y> Op for AbnormalSoftmax<A>

Source§

impl<A: Op<Output = Y>, Y> Op for Choose<A>
where ChooseLayer: AI<Y, u32>,

Source§

impl<A: Op<Output = Y>, Y> Op for CrossEntropy<A>

Source§

impl<A: Op<Output = Y>, Y> Op for LogSoftmax<A>
where LogSoftmaxLayer: AI<Y, Vec<f32>>,

Source§

impl<A: Op<Output = Y>, Y> Op for Softmax<A>
where SoftmaxLayer: AI<Y, Vec<f32>>,

Source§

impl<A: Op<Output = Y>, Y> Op for Duplicate<A>

Source§

impl<A: Op<Output = Y>, Y> Op for Map<A>

Source§

impl<A: Op<Output = Y>, Y> Op for Residual<A>

Source§

impl<A: Op<Output = Y>, Y, B: Op<Output = Z>, Z> Op for Zip<(A, B)>

Source§

impl<A: Op<Output = Y>, Y: Cat<Output = Z>, Z> Op for Cat<A>
where CatLayer: AI<Y, Z>,

Source§

impl<A: Op<Output = Y>, Y: Squeeze<Output = Z>, Z> Op for Squeeze<A>
where SqueezeLayer: AI<Y, Z>,

Source§

impl<A: Op<Output = Y>, Y: Stack<Output = Z>, Z> Op for Stack<A>
where StackLayer: AI<Y, Z>,

Source§

impl<A: Op<Output = Y>, Y: Unsqueeze<Output = Z>, Z> Op for Unsqueeze<A>
where UnsqueezeLayer: AI<Y, Z>,

Source§

impl<B: Backend> Op for Layer<B>

Source§

impl<B: Backend> Op for Identity<B>

Source§

impl<C: Op> Op for Graph<C>

Source§

type Output = Vec<<C as Op>::Output>

Source§

impl<F: Fn(X) -> Y, X, Y> Op for Apply<F, X, Y>

Source§

impl<R: Clone> Op for FlattenLayer<R>

Source§

impl<R: Clone> Op for ReshapeLayer<R>

Source§

impl<W: Op + Wrappable> Op for Wrapped<W>

Source§

type Output = <W as Op>::Output