Struct burn_tensor::Data

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

Fields§

§value: Vec<P>§shape: Shape<D>

Implementations§

source§

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

source

pub fn new(value: Vec<P>, shape: Shape<D>) -> Self

Constructs a new Data.

source§

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

source

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

source§

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

source

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

source§

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

source

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

source§

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

source

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

source

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

source§

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

source

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

source

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

source§

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

source

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

source§

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

source

pub fn assert_approx_eq(&self, other: &Self, precision: usize)

source§

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

source

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

Trait Implementations§

source§

impl<P: Clone, const D: usize> Clone for Data<P, D>

source§

fn clone(&self) -> Data<P, 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<P: Debug, const D: usize> Debug for Data<P, D>

source§

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

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

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

source§

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

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

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

source§

fn from(elems: &[P]) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(data: &DataSerialize<P>) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(elems: [[[[P; D]; C]; B]; A]) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(elems: [[[P; C]; B]; A]) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(elems: [[P; B]; A]) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(elems: [P; A]) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(data: DataSerialize<P>) -> Self

Converts to this type from the input type.
source§

impl<P: PartialEq, const D: usize> PartialEq<Data<P, D>> for Data<P, D>

source§

fn eq(&self, other: &Data<P, 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<P: Eq, const D: usize> Eq for Data<P, D>

source§

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

source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<P, const D: usize> UnwindSafe for Data<P, D>where P: 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.
const: unstable · 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.
const: unstable · 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