[−][src]Struct auto_diff::tensor::GenTensor
Methods
impl<T> GenTensor<T> where
T: Float, [src]
T: Float,
pub fn new_raw(data: &Vec<T>, shape: &Vec<u32>) -> GenTensor<T>[src]
pub fn new_val(d: T, shape: &Vec<u32>) -> GenTensor<T>[src]
pub fn stride(&self) -> Vec<u32>[src]
Right dimension changes fastest. Right dimension has the stride 1.
let m1 = GenTensor::<f64>::new_raw(&vec![0.; 3*5*2], &vec![3,5,2]); assert_eq!(m1.stride(), vec![10,2,1]);
pub fn get(&self, o: &Vec<u32>) -> T[src]
Return value at the index of the tensor.
let m1 = GenTensor::<f64>::new_raw(&vec![1.,2.,3.,4.,5.,6.], &vec![2,3]); assert_eq!(m1.get(&vec![1,1]), 5.);
pub fn add(&self, o: &GenTensor<T>) -> GenTensor<T>[src]
element-wise add.
let m1 = GenTensor::<f64>::new_raw(&vec![1.,2.,3.,4.,], &vec![2,2]); let m2 = GenTensor::<f64>::new_raw(&vec![1.,2.,3.,4.,], &vec![2,2]); let m3 = m1.add(&m2); assert_eq!(m3.get(&vec![0,0]), 2.); assert_eq!(m3.get(&vec![1,1]), 8.);
pub fn sub(&self, o: &GenTensor<T>) -> GenTensor<T>[src]
pub fn mul(&self, o: &GenTensor<T>) -> GenTensor<T>[src]
pub fn div(&self, o: &GenTensor<T>) -> GenTensor<T>[src]
pub fn mm(&self, o: GenTensor<T>)[src]
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for GenTensor<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for GenTensor<T> where
T: Send,
T: Send,
impl<T> Sync for GenTensor<T> where
T: Sync,
T: Sync,
impl<T> Unpin for GenTensor<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for GenTensor<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,