Value

Enum Value 

Source
pub enum Value<B: Backend> {
Show 26 variants B1(Tensor<B, 1, Bool>), B2(Tensor<B, 2, Bool>), B3(Tensor<B, 3, Bool>), B4(Tensor<B, 4, Bool>), B5(Tensor<B, 5, Bool>), B6(Tensor<B, 6, Bool>), B7(Tensor<B, 7, Bool>), B8(Tensor<B, 8, Bool>), F1(Tensor<B, 1, Float>), F2(Tensor<B, 2, Float>), F3(Tensor<B, 3, Float>), F4(Tensor<B, 4, Float>), F5(Tensor<B, 5, Float>), F6(Tensor<B, 6, Float>), F7(Tensor<B, 7, Float>), F8(Tensor<B, 8, Float>), I1(Tensor<B, 1, Int>), I2(Tensor<B, 2, Int>), I3(Tensor<B, 3, Int>), I4(Tensor<B, 4, Int>), I5(Tensor<B, 5, Int>), I6(Tensor<B, 6, Int>), I7(Tensor<B, 7, Int>), I8(Tensor<B, 8, Int>), Incompatible(String), Multi(Vec<Self>),
}
Expand description

enumerates burn tensors up to 8 dimensions, along with a variant to represent operation compatibility errors, and a variant for multiple tensors. An empty multi variant can be used to represent a lack of data. Once a the depth of a multi variant is enough for an operation to take full effect, further nesting should result in the same as applying separately

Variants§

§

B1(Tensor<B, 1, Bool>)

§

B2(Tensor<B, 2, Bool>)

§

B3(Tensor<B, 3, Bool>)

§

B4(Tensor<B, 4, Bool>)

§

B5(Tensor<B, 5, Bool>)

§

B6(Tensor<B, 6, Bool>)

§

B7(Tensor<B, 7, Bool>)

§

B8(Tensor<B, 8, Bool>)

§

F1(Tensor<B, 1, Float>)

§

F2(Tensor<B, 2, Float>)

§

F3(Tensor<B, 3, Float>)

§

F4(Tensor<B, 4, Float>)

§

F5(Tensor<B, 5, Float>)

§

F6(Tensor<B, 6, Float>)

§

F7(Tensor<B, 7, Float>)

§

F8(Tensor<B, 8, Float>)

§

I1(Tensor<B, 1, Int>)

§

I2(Tensor<B, 2, Int>)

§

I3(Tensor<B, 3, Int>)

§

I4(Tensor<B, 4, Int>)

§

I5(Tensor<B, 5, Int>)

§

I6(Tensor<B, 6, Int>)

§

I7(Tensor<B, 7, Int>)

§

I8(Tensor<B, 8, Int>)

§

Incompatible(String)

§

Multi(Vec<Self>)

Implementations§

Source§

impl<B: Backend> Value<B>

Source

pub fn all(self) -> Value<B>

tests if all values are true

Source

pub fn all_dim(self, d: i32) -> Value<B>

tests if all values are true along the dim

Source

pub fn any(self) -> Value<B>

tests if any values are true

Source

pub fn any_dim(self, d: i32) -> Value<B>

tests if any values are true along the dim

Source

pub fn bool(self) -> Value<B>

casts to a bool tensor if not one

Source

pub fn count(&self) -> usize

counts the number of components in the tensor

Source

pub fn empty() -> Self

creates a new empty value

Source

pub fn flatten_values(self) -> Self

flattens depth first into a list of tensors

Source

pub fn float(self) -> Value<B>

casts to a float tensor if not one

Source

pub fn from_values<I: IntoIterator<Item = Self>, S: Into<Shape>>( inner: I, shape: S, ) -> Self

creates a value from the inner values and recursive shape. Doesn’t check actual dimension values, the shape is just used for recursion data

Source

pub fn gather(self, dim: i32, indices: Value<B>) -> Self

gather

Source

pub fn int(self) -> Value<B>

casts to a int tensor if not one

Source

pub fn into_float_vec(self) -> Vec<f32>

converts to a flattened vector of floats, ignoring incompatibility errors

Source

pub fn into_int_vec(self) -> Vec<i32>

converts to a flattened vector of ints, ignoring incompatibility errors

Source

pub fn height(&self) -> usize

returns the maximum recursive depth of the value tree (its height). Returns 0 for empty or single

Source

pub fn is_empty(&self) -> bool

tests if the tensor is empty. incompatible isn’t considered empty for the purposes of this function

Source

pub fn is_incompatible(&self) -> bool

tests if the tensor represents the result of an incompatible input and operation

Source

pub fn into_multi(self) -> Vec<Value<B>>

converts to a multiple tensor, then unwraps to a vec of values

Source

pub fn is_multi(&self) -> bool

tests if this is a multiple tensor. also returns true for empty and multi that only have one value

Source

pub fn iter(&self) -> SliceIter<'_, Self>

shallow iteration over the contained values

Source

pub fn kind(&self) -> Kind

returns the kind of value

Source

pub fn len(&self) -> usize

returns a shallow count the number of values directly within this one. 1 if not multi, otherwise the len of the vec inside.

Source

pub fn len_recursive(&self) -> usize

recursively counts the number of tensors within this value, including multi tensors within multi tensors

Source

pub fn map_multi<F: FnMut(Value<B>) -> Value<B>>( self, depth: usize, f: F, ) -> Self

applies a function to each multi tensor value whose maximum distance to a leaf is depth. The depth for empty or single is 0, multi containing only empty or single is 1, etc

Source

pub fn map_values<F: FnMut(Value<B>) -> Value<B>>(self, f: F) -> Self

applies a function to each single tensor value

Source

pub fn mask_fill(self, mask: Value<B>, v: f32) -> Self

mask filling

Source

pub fn multi(self) -> Self

casts to a multiple tensor if not one

Source

pub fn new<S: Into<Shape>>(data: &[f32], device: &B::Device, shape: S) -> Self

creates a new multi tensor from the data and shape // TODO make work for bool and int too

Source

pub fn promote(self, rhs: Value<B>) -> (Value<B>, Value<B>)

promotes the values to make them compatible if possible. bools can become floats or ints, ints can become floats, any can become multi, and lower ranks can be unsqueezed to higher ranks. This is a shallow operation, so tensors inside multi will be unaffected. incompatible with non multi will return the input

Source

pub fn promote_kind(self, rhs: Value<B>) -> (Value<B>, Value<B>)

promotes the values to make them match if possible. bools can become floats or ints, ints can become floats, any can become multi. This is a shallow operation, so tensors inside multi will be unaffected. incompatible with non multi will return the input

Source

pub fn promote_rank(self, rhs: Value<B>) -> (Value<B>, Value<B>)

promotes the values to make them match if possible. lower ranks can be unsqueezed to higher ranks. This is a shallow operation, so tensors inside multi will be unaffected. incompatible with non multi will return the input

Source

pub fn rank(&self) -> Option<usize>

returns the number of axes of the tensor, or none if incompatible or multi

Source

pub fn scatter(self, dim: i32, indices: Value<B>, values: Value<B>) -> Self

scatter

Source

pub fn shape(&self) -> Shape

gets the shape of the tensor. Use the recursive version to recursively get the multi shape

Source

pub fn shape_recursive(&self) -> Shape

gets the shape of the tensor. Use the non recusive function if deep shape structure of multi is not required

Source

pub fn shift(self, d: i32, n: i32, v: f32) -> Self

shifts the components right n places, maintaining the current dimensions, filling the left spot with v cast to the appropriate type

Source

pub fn slice<A: AsRef<[R]>, R: RangeBounds<usize>>(self, ranges: A) -> Self

returns a value containing the elements selected from the given ranges. If this is a multi tensor the slice will be applied to each sub tensor

Source

pub fn split<I: Into<Option<i32>>>(self, chunksize: usize, dim: I) -> Self

splits into chunks along the dimension, or the multi vector if dim is None

Source

pub fn squeeze(self) -> Self

squeeze 0

Source

pub fn squeeze_dim(self, d: i32) -> Self

removes a dimension of size 1 at position d. incompatible if dimension at position d is not 1

Source

pub fn try_incompatible(self) -> Result<String, Self>

attempts to unwrap the inner incompatible value

Source

pub fn try_multi(self) -> Result<Vec<Value<B>>, Self>

attempts to unwrap the inner multi value

Source

pub fn unsqueeze(self) -> Self

unsqueeze 0

Source

pub fn unsqueeze_dim(self, d: i32) -> Self

inserts a dimension of size 1 at position d, or N+d+1 if d is negative

Source

pub fn unwrap_incompatible(self) -> String

attempts to unwrap the inner incompatible value

Source

pub fn unwrap_multi(self) -> Vec<Value<B>>

attempts to unwrap the inner multi value

Source

pub fn zeros_like(&self) -> Value<B>

zeros like

Source

pub fn zip(self) -> Self

takes in a multi value and zips the leaves of each inner value together. If this input is empty or single it is returned unchanged. Mistmatch between single and multi substructures will cause the multi to be interpreted as a leaf. Mismatch between multi lengths will cause the shorter to be extended with empty

Source

pub fn try_b1(self) -> Result<Tensor<B, 1, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b1(self) -> Tensor<B, 1, Bool>

attempts to unwrap the inner value

Source

pub fn try_b2(self) -> Result<Tensor<B, 2, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b2(self) -> Tensor<B, 2, Bool>

attempts to unwrap the inner value

Source

pub fn try_b3(self) -> Result<Tensor<B, 3, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b3(self) -> Tensor<B, 3, Bool>

attempts to unwrap the inner value

Source

pub fn try_b4(self) -> Result<Tensor<B, 4, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b4(self) -> Tensor<B, 4, Bool>

attempts to unwrap the inner value

Source

pub fn try_b5(self) -> Result<Tensor<B, 5, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b5(self) -> Tensor<B, 5, Bool>

attempts to unwrap the inner value

Source

pub fn try_b6(self) -> Result<Tensor<B, 6, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b6(self) -> Tensor<B, 6, Bool>

attempts to unwrap the inner value

Source

pub fn try_b7(self) -> Result<Tensor<B, 7, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b7(self) -> Tensor<B, 7, Bool>

attempts to unwrap the inner value

Source

pub fn try_b8(self) -> Result<Tensor<B, 8, Bool>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_b8(self) -> Tensor<B, 8, Bool>

attempts to unwrap the inner value

Source

pub fn try_f1(self) -> Result<Tensor<B, 1, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f1(self) -> Tensor<B, 1, Float>

attempts to unwrap the inner value

Source

pub fn try_f2(self) -> Result<Tensor<B, 2, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f2(self) -> Tensor<B, 2, Float>

attempts to unwrap the inner value

Source

pub fn try_f3(self) -> Result<Tensor<B, 3, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f3(self) -> Tensor<B, 3, Float>

attempts to unwrap the inner value

Source

pub fn try_f4(self) -> Result<Tensor<B, 4, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f4(self) -> Tensor<B, 4, Float>

attempts to unwrap the inner value

Source

pub fn try_f5(self) -> Result<Tensor<B, 5, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f5(self) -> Tensor<B, 5, Float>

attempts to unwrap the inner value

Source

pub fn try_f6(self) -> Result<Tensor<B, 6, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f6(self) -> Tensor<B, 6, Float>

attempts to unwrap the inner value

Source

pub fn try_f7(self) -> Result<Tensor<B, 7, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f7(self) -> Tensor<B, 7, Float>

attempts to unwrap the inner value

Source

pub fn try_f8(self) -> Result<Tensor<B, 8, Float>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_f8(self) -> Tensor<B, 8, Float>

attempts to unwrap the inner value

Source

pub fn try_i1(self) -> Result<Tensor<B, 1, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i1(self) -> Tensor<B, 1, Int>

attempts to unwrap the inner value

Source

pub fn try_i2(self) -> Result<Tensor<B, 2, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i2(self) -> Tensor<B, 2, Int>

attempts to unwrap the inner value

Source

pub fn try_i3(self) -> Result<Tensor<B, 3, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i3(self) -> Tensor<B, 3, Int>

attempts to unwrap the inner value

Source

pub fn try_i4(self) -> Result<Tensor<B, 4, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i4(self) -> Tensor<B, 4, Int>

attempts to unwrap the inner value

Source

pub fn try_i5(self) -> Result<Tensor<B, 5, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i5(self) -> Tensor<B, 5, Int>

attempts to unwrap the inner value

Source

pub fn try_i6(self) -> Result<Tensor<B, 6, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i6(self) -> Tensor<B, 6, Int>

attempts to unwrap the inner value

Source

pub fn try_i7(self) -> Result<Tensor<B, 7, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i7(self) -> Tensor<B, 7, Int>

attempts to unwrap the inner value

Source

pub fn try_i8(self) -> Result<Tensor<B, 8, Int>, Self>

attempts to unwrap the inner value

Source

pub fn unwrap_i8(self) -> Tensor<B, 8, Int>

attempts to unwrap the inner value

Trait Implementations§

Source§

impl<B: Backend> AI<(Value<B>, Value<B>), Value<B>> for CrossEntropyLayer

Source§

fn forward(&self, (output, target): (Value<B>, Value<B>)) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<(Value<B>, Value<B>), Value<B>> for CrossEntropyLoss<B>

Source§

fn forward(&self, (output, target): (Value<B>, Value<B>)) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<(Value<B>, Value<B>), Value<B>> for SquaredErrorLayer

Source§

fn forward(&self, (output, target): (Value<B>, Value<B>)) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<(Value<B>, Value<B>, Value<B>), Value<B>> for Attention<B>

Source§

fn forward(&self, (k, q, v): (Value<B>, Value<B>, Value<B>)) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, (Value<B>, Value<B>, Value<B>)> for KQV<B>

Source§

fn forward(&self, input: Value<B>) -> (Value<B>, Value<B>, Value<B>)

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Tensor<B, 1>> for MeanLayer

Source§

fn forward(&self, input: Value<B>) -> Tensor<B, 1>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Tensor<B, 1>> for SumLayer

Source§

fn forward(&self, input: Value<B>) -> Tensor<B, 1>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for AccQLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Attention<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for BatchNorm<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Cache<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

fn forward_mut(&mut self, input: Value<B>) -> Value<B>

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for ChooseLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Conv2d<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for CrossEntropyLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for CrossEntropyLoss<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Dropout

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Embedding<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for KQV<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Layer<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

fn forward_mut(&mut self, input: Value<B>) -> Value<B>

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for LayerNorm<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Linear<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for MaxPool2d

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for MeanLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for MseLoss

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Relu

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for RotaryEncoding<B>

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for SoftmaxLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for SquaredErrorLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for SumLayer

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Value<B>> for Tanh

Source§

fn forward(&self, input: Value<B>) -> Value<B>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, Vec<u32>> for ChooseLayer

Source§

fn forward(&self, input: Value<B>) -> Vec<u32>

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, f32> for MeanLayer

Source§

fn forward(&self, input: Value<B>) -> f32

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, f32> for SumLayer

Source§

fn forward(&self, input: Value<B>) -> f32

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> AI<Value<B>, u32> for ChooseLayer

Source§

fn forward(&self, input: Value<B>) -> u32

applies to the input
Source§

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

applies to the input, possibly updating internal caches
Source§

impl<B: Backend> Abs for Value<B>

Source§

type Output = Value<B>

the output type
Source§

fn abs(self) -> Self::Output

computes the operation
Source§

fn _apply(self) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Backend> Add<&Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Value<B>) -> Value<B>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<&Value<B>> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Value<B>) -> Value<B>

Performs the + operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Add<E> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: E) -> Value<B>

Performs the + operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Add<E> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: E) -> Value<B>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Value<B>) -> Value<B>

Performs the + operation. Read more
Source§

impl<B: Backend> Add for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Value<B>) -> Value<B>

Performs the + operation. Read more
Source§

impl<B: Backend> AsRef<Value<B>> for Value<B>

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: AutodiffBackend> AutodiffModule<A> for Value<A>

Source§

type InnerModule = Value<<A as AutodiffBackend>::InnerBackend>

Inner module without auto-differentiation.
Source§

fn valid(&self) -> Self::InnerModule

Get the same module, but on the inner backend without auto-differentiation.
Source§

impl<B: Backend> Cat for Value<B>

Source§

fn cat(self, d: i32) -> Self

concatenates the multi tensor along dimension d

Source§

type Output = Value<B>

the output type
Source§

fn _apply(self, dim: i32) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Clone + Backend> Clone for Value<B>

Source§

fn clone(&self) -> Value<B>

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<B: Debug + Backend> Debug for Value<B>

Source§

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

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

impl<B: Backend> Decompose for Value<B>

Source§

type Decomposition = Value<B>

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<B: Backend> Default for Value<B>

Source§

fn default() -> Self

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

impl<'a, B: Backend> Deserialize<'a> for Value<B>

Source§

fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<B: Backend> Display for Value<B>

Source§

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

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

impl<B: Backend> Div<&Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Value<B>) -> Value<B>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<&Value<B>> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Value<B>) -> Value<B>

Performs the / operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Div<E> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: E) -> Value<B>

Performs the / operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Div<E> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: E) -> Value<B>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Value<B>) -> Value<B>

Performs the / operation. Read more
Source§

impl<B: Backend> Div for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Value<B>) -> Value<B>

Performs the / operation. Read more
Source§

impl<B: Backend, R: Clone + RangeBounds<isize>> Flatten<R> for Value<B>

Source§

type Output = Value<B>

the output type
Source§

fn flatten(self, args: R) -> Self::Output

flattens
Source§

fn _apply(self, args: R) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Backend, S: ?Sized + AsRef<str>> From<&S> for Value<B>

Source§

fn from(value: &S) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend, K: 'static + TensorKind<B>, const N: usize> From<Result<Tensor<B, N, K>, String>> for Value<B>

Source§

fn from(value: Result<Tensor<B, N, K>, String>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend> From<String> for Value<B>

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend, K: 'static + TensorKind<B>, const N: usize> From<Tensor<B, N, K>> for Value<B>

Source§

fn from(value: Tensor<B, N, K>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend> From<Vec<Value<B>>> for Value<B>

Source§

fn from(value: Vec<Value<B>>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend> From<Vec<bool>> for Value<B>

Source§

fn from(value: Vec<bool>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend> From<Vec<f32>> for Value<B>

Source§

fn from(value: Vec<f32>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend> From<Vec<i32>> for Value<B>

Source§

fn from(value: Vec<i32>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend> From<Vec<u32>> for Value<B>

Source§

fn from(value: Vec<u32>) -> Self

Converts to this type from the input type.
Source§

impl<A: Into<Value<B>>, B: Backend> FromIterator<A> for Value<B>

Source§

fn from_iter<I: IntoIterator<Item = A>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<B: Backend> IntoIterator for Value<B>

Source§

type IntoIter = IntoIter<Value<B>>

Which kind of iterator are we turning this into?
Source§

type Item = Value<B>

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<B: Backend> Merge for Value<B>

Source§

fn merge(&mut self, other: Self)

merges the other into self, taking out of other if convenient
Source§

impl<B: Backend> Module<B> for Value<B>

Source§

type Record = ConstantRecord

Type to save and load the module.
Source§

fn collect_devices( &self, devices: Vec<<B as Backend>::Device>, ) -> Vec<<B as Backend>::Device>

Return all the devices found in the underneath module tree added to the given vector without duplicates.
Source§

fn devices(&self) -> Vec<<B as Backend>::Device>

Return all the devices found in the underneath module tree without duplicates.
Source§

fn fork(self, device: &<B as Backend>::Device) -> Self

Fork the module and all of its sub-modules to the given device. Read more
Source§

fn into_record(self) -> Self::Record

Convert the module into a record containing the state.
Source§

fn load_file<F: FileRecorder<B>, P: Into<PathBuf>>( self, _filepath: P, _recorder: &F, _device: &<B as Backend>::Device, ) -> Result<Self, RecorderError>

Load the module from a file using the provided file recorder. Read more
Source§

fn load_record(self, _record: Self::Record) -> Self

Load the module state from a record.
Source§

fn map<Mapper: ModuleMapper<B>>(self, mapper: &mut Mapper) -> Self

Map each tensor parameter in the module with a mapper.
Source§

fn num_params(&self) -> usize

Get the number of parameters the module has, including all of its sub-modules.
Source§

fn quantize_weights(self, quantizer: &mut Quantizer) -> Self

Quantize the weights of the module.
Source§

fn save_file<F: FileRecorder<B>, P: Into<PathBuf>>( self, _filepath: P, _recorder: &F, ) -> Result<(), RecorderError>

Save the module to a file using the provided file recorder. Read more
Source§

fn to_device(self, device: &<B as Backend>::Device) -> Self

Move the module and all of its sub-modules to the given device. Read more
Source§

fn visit<Visitor: ModuleVisitor<B>>(&self, visitor: &mut Visitor)

Visit each tensor parameter in the module with a visitor.
Source§

fn no_grad(self) -> Self

Each tensor in the module tree will not require grad. Read more
Source§

impl<B: Backend> ModuleDisplay for Value<B>

Source§

fn custom_content(&self, _content: Content) -> Option<Content>

Custom attributes for the module. Read more
Source§

fn custom_settings(&self) -> Option<DisplaySettings>

Custom display settings for the module. Read more
Source§

fn format(&self, s: DisplaySettings) -> String

Formats the module with provided display settings. Read more
Source§

impl<B: Backend> ModuleDisplayDefault for Value<B>

Source§

fn content(&self, content: Content) -> Option<Content>

Attributes of the module used for display purposes. Read more
Source§

fn num_params(&self) -> usize

Gets the number of the parameters of the module.
Source§

impl<B: Backend> Mul<&Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Value<B>) -> Value<B>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<&Value<B>> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Value<B>) -> Value<B>

Performs the * operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Mul<E> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: E) -> Value<B>

Performs the * operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Mul<E> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: E) -> Value<B>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Value<B>) -> Value<B>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Value<B>) -> Value<B>

Performs the * operation. Read more
Source§

impl<B: Backend> Rem<&Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Value<B>) -> Value<B>

Performs the % operation. Read more
Source§

impl<B: Backend> Rem<&Value<B>> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Value<B>) -> Value<B>

Performs the % operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Rem<E> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: E) -> Value<B>

Performs the % operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Rem<E> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: E) -> Value<B>

Performs the % operation. Read more
Source§

impl<B: Backend> Rem<Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Value<B>) -> Value<B>

Performs the % operation. Read more
Source§

impl<B: Backend> Rem for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Value<B>) -> Value<B>

Performs the % operation. Read more
Source§

impl<B: Backend, R: Into<Reshape>> Reshape<R> for Value<B>

Source§

type Output = Value<B>

the output type
Source§

fn reshape(self, args: R) -> Self::Output

reshapes
Source§

fn _apply(self, args: R) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Backend> Serialize for Value<B>

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<B: Backend> Squeeze for Value<B>

Source§

type Output = Value<B>

the output type
Source§

fn squeeze(self, d: i32) -> Self

computes the operation
Source§

fn _apply(self, dim: i32) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Backend> Stack for Value<B>

Source§

fn stack(self, d: i32) -> Self

stacks the multi tensor, inserting a dimension at d, or N+d+1 if d is negative. for singular tensors this has an unsqueezing effect

Source§

type Output = Value<B>

the output type
Source§

fn _apply(self, dim: i32) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Backend> Sub<&Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Value<B>) -> Value<B>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<&Value<B>> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Value<B>) -> Value<B>

Performs the - operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Sub<E> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: E) -> Value<B>

Performs the - operation. Read more
Source§

impl<B: Backend, E: Copy + ElementConversion> Sub<E> for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: E) -> Value<B>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Value<B>> for &Value<B>

Source§

type Output = Value<B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Value<B>) -> Value<B>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub for Value<B>

Source§

type Output = Value<B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Value<B>) -> Value<B>

Performs the - operation. Read more
Source§

impl<B: Backend, C: Backend> ToBackend<C> for Value<B>

Source§

type OnBackend = Value<C>

the type on the new backend
Source§

fn to_backend_device(self, device: &C::Device) -> Self::OnBackend

moves the module to the backend with the device
Source§

fn to_backend(self) -> Self::OnBackend

moves the module to the backend with the device
Source§

impl<B: Backend, K: 'static + TensorKind<B>, const N: usize> TryFrom<Value<B>> for Tensor<B, N, K>

Source§

type Error = Value<B>

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

fn try_from(value: Value<B>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<B: Backend> Unsqueeze for Value<B>

Source§

type Output = Value<B>

the output type
Source§

fn unsqueeze(self, d: i32) -> Self

computes the operation
Source§

fn _apply(self, dim: i32) -> Self::Output
where Self: Sized,

macro convenience version of the primary method
Source§

impl<B: Backend> Wrappable for Value<B>

Source§

type B = B

Source§

type With<C: Backend> = Value<C>

Auto Trait Implementations§

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<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> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
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> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,