Struct burn_core::tensor::Data

source ·
pub struct Data<E, const D: usize> {
    pub value: Vec<E, Global>,
    pub shape: Shape<D>,
}

Fields§

§value: Vec<E, Global>§shape: Shape<D>

Implementations§

source§

impl<E, const D: usize> Data<E, D>

source

pub fn new(value: Vec<E, Global>, shape: Shape<D>) -> Data<E, D>

Constructs a new Data.

source§

impl<const D: usize, E> Data<E, D>where E: Element,

source

pub fn convert<EOther>(self) -> Data<EOther, D>where EOther: Element,

source§

impl<const D: usize> Data<bool, D>

source

pub fn convert<E>(self) -> Data<E, D>where E: Element,

source§

impl<E, const D: usize> Data<E, D>where E: Element,

source

pub fn random<R>( shape: Shape<D>, distribution: Distribution<E>, rng: &mut R ) -> Data<E, D>where R: RngCore,

source§

impl<E, const D: usize> Data<E, D>where E: Debug + Element,

source

pub fn zeros<S>(shape: S) -> Data<E, D>where S: Into<Shape<D>>,

source

pub fn zeros_(shape: Shape<D>, _kind: E) -> Data<E, D>

source§

impl<E, const D: usize> Data<E, D>where E: Debug + Element,

source

pub fn ones(shape: Shape<D>) -> Data<E, D>

source

pub fn ones_(shape: Shape<D>, _kind: E) -> Data<E, D>

source§

impl<E, const D: usize> Data<E, D>where E: Debug + Copy,

source

pub fn serialize(&self) -> DataSerialize<E>

source§

impl<E, const D: usize> Data<E, D>where E: Into<f64> + Clone + Debug + PartialEq<E>,

source

pub fn assert_approx_eq(&self, other: &Data<E, D>, precision: usize)

source

pub fn assert_in_range(&self, min: E, max: E)

source§

impl<const D: usize> Data<usize, D>

source

pub fn from_usize<O>(self) -> Data<O, D>where O: FromPrimitive,

Trait Implementations§

source§

impl<E, const D: usize> Clone for Data<E, D>where E: Clone,

source§

fn clone(&self) -> Data<E, D>

Returns a copy 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<E, const D: usize> Debug for Data<E, D>where E: Debug,

source§

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

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

impl<E, const D: usize> Display for Data<E, D>where E: Debug,

source§

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

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

impl<E> From<&[E]> for Data<E, 1>where E: Debug + Copy,

source§

fn from(elems: &[E]) -> Data<E, 1>

Converts to this type from the input type.
source§

impl<E, const D: usize> From<&DataSerialize<E>> for Data<E, D>where E: Clone,

source§

fn from(data: &DataSerialize<E>) -> Data<E, D>

Converts to this type from the input type.
source§

impl<E, const A: usize, const B: usize, const C: usize, const D: usize> From<[[[[E; D]; C]; B]; A]> for Data<E, 4>where E: Debug + Copy,

source§

fn from(elems: [[[[E; D]; C]; B]; A]) -> Data<E, 4>

Converts to this type from the input type.
source§

impl<E, const A: usize, const B: usize, const C: usize> From<[[[E; C]; B]; A]> for Data<E, 3>where E: Debug + Copy,

source§

fn from(elems: [[[E; C]; B]; A]) -> Data<E, 3>

Converts to this type from the input type.
source§

impl<E, const A: usize, const B: usize> From<[[E; B]; A]> for Data<E, 2>where E: Debug + Copy,

source§

fn from(elems: [[E; B]; A]) -> Data<E, 2>

Converts to this type from the input type.
source§

impl<E, const A: usize> From<[E; A]> for Data<E, 1>where E: Debug + Copy,

source§

fn from(elems: [E; A]) -> Data<E, 1>

Converts to this type from the input type.
source§

impl<E, const D: usize> From<DataSerialize<E>> for Data<E, D>

source§

fn from(data: DataSerialize<E>) -> Data<E, D>

Converts to this type from the input type.
source§

impl<E, const D: usize> PartialEq<Data<E, D>> for Data<E, D>where E: PartialEq<E>,

source§

fn eq(&self, other: &Data<E, D>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<E, const D: usize> Eq for Data<E, D>where E: Eq,

source§

impl<E, const D: usize> StructuralEq for Data<E, D>

source§

impl<E, const D: usize> StructuralPartialEq for Data<E, D>

Auto Trait Implementations§

§

impl<E, const D: usize> RefUnwindSafe for Data<E, D>where E: RefUnwindSafe,

§

impl<E, const D: usize> Send for Data<E, D>where E: Send,

§

impl<E, const D: usize> Sync for Data<E, D>where E: Sync,

§

impl<E, const D: usize> Unpin for Data<E, D>where E: Unpin,

§

impl<E, const D: usize> UnwindSafe for Data<E, D>where E: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere 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<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V