Inner

Struct Inner 

Source
#[repr(transparent)]
pub struct Inner<A>(pub A);
Expand description

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

Tuple Fields§

§0: A

Implementations§

Source§

impl<A> Inner<A>

Source

pub fn inner(&self) -> &A

references the inner value

Source

pub fn inner_mut(&mut self) -> &mut A

references the inner value

Source

pub fn into_inner(self) -> A

converts into the inner value

Trait Implementations§

Source§

impl<A: AI<X, Y>, X, Y> AI<X, Y> for Inner<A>

Source§

fn forward(&self, input: X) -> Y

applies to the input
Source§

fn forward_mut(&mut self, input: X) -> Y

applies to the input, possibly updating internal caches
Source§

impl<A: Clone> Clone for Inner<A>

Source§

fn clone(&self) -> Inner<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug> Debug for Inner<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Decompose> Decompose for Inner<A>

Source§

type Decomposition = <A as Decompose>::Decomposition

the decomposed type
Source§

fn compose(decomposition: Self::Decomposition) -> Self

recreates from the decomposition
Source§

fn decompose(self) -> Self::Decomposition

owned decomposition
Source§

fn decompose_cloned(&self) -> Self::Decomposition

decomposition that copies data
Source§

impl<A: Default> Default for Inner<A>

Source§

fn default() -> Inner<A>

Returns the “default value” for a type. Read more
Source§

impl<A> From<A> for Inner<A>

Source§

fn from(inner: A) -> Self

Converts to this type from the input type.
Source§

impl<A: Hash> Hash for Inner<A>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<A: IntoSequence<M>, M: AI<M::Output, M::Output> + Op> IntoSequence<M> for Inner<A>

Source§

fn into_sequence(self) -> Sequential<Vec<M>>

converts into a sequential module list
Source§

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

Source§

type Output = <A as Op>::Output

suggested output type to help with composition coherence. Ideally, Self should implement AI<X,Self::Output> for some X
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 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
Source§

impl<A: Ord> Ord for Inner<A>

Source§

fn cmp(&self, other: &Inner<A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<A: PartialEq> PartialEq for Inner<A>

Source§

fn eq(&self, other: &Inner<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: PartialOrd> PartialOrd for Inner<A>

Source§

fn partial_cmp(&self, other: &Inner<A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<A> UnwrapInner for Inner<A>

Source§

type Inner = A

the inner type
Source§

fn unwrap_inner(self) -> Self::Inner

unwraps the inner value
Source§

impl<W: Wrappable> Wrappable for Inner<W>

Source§

type B = <W as Wrappable>::B

Source§

type With<C: Backend> = Inner<<W as Wrappable>::With<C>>

Source§

impl<A: Copy> Copy for Inner<A>

Source§

impl<A: Eq> Eq for Inner<A>

Source§

impl<A> StructuralPartialEq for Inner<A>

Auto Trait Implementations§

§

impl<A> Freeze for Inner<A>
where A: Freeze,

§

impl<A> RefUnwindSafe for Inner<A>
where A: RefUnwindSafe,

§

impl<A> Send for Inner<A>
where A: Send,

§

impl<A> Sync for Inner<A>
where A: Sync,

§

impl<A> Unpin for Inner<A>
where A: Unpin,

§

impl<A> UnwindSafe for Inner<A>
where A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Adaptor<()> for T

Source§

fn adapt(&self)

Adapt the type to be passed to a metric.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Shortcuts for T
where T: Op + ?Sized,

Source§

fn classification(self) -> Classification<Self>
where Classification<Self>: Op, Self: Sized,

wraps in a classification wrapper
Source§

fn regression(self) -> Regression<Self>
where Regression<Self>: Op, Self: Sized,

wraps in a regression wrapper
Source§

fn wrap(self) -> Wrapped<Self>
where Self: Wrappable,

wraps in a burn wrapper
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V