Struct burn_tensor::Tensor
source · [−]Implementations
sourceimpl<const D: usize, B> Tensor<B, D>where
B: Backend,
impl<const D: usize, B> Tensor<B, D>where
B: Backend,
pub fn new(tensor: B::TensorPrimitive<D>) -> Self
pub fn reshape<const D2: usize>(&self, shape: Shape<D2>) -> Tensor<B, D2>
pub fn to_device(&self, device: B::Device) -> Self
pub fn exp(&self) -> Self
pub fn log(&self) -> Self
pub fn device(&self) -> B::Device
pub fn shape(&self) -> &Shape<D>
pub fn into_data(self) -> Data<B::Elem, D>
pub fn to_data(&self) -> Data<B::Elem, D>
pub fn zeros_like(&self) -> Self
pub fn one_hot(index: usize, num_classes: usize) -> Self
pub fn ones_like(&self) -> Self
pub fn random_like(&self, distribution: Distribution<B::Elem>) -> Self
pub fn add(&self, other: &Self) -> Self
pub fn add_scalar(&self, other: &B::Elem) -> Self
pub fn sub(&self, other: &Self) -> Self
pub fn sub_scalar(&self, other: &B::Elem) -> Self
pub fn transpose(&self) -> Self
pub fn matmul(&self, other: &Self) -> Self
pub fn neg(&self) -> Self
pub fn mul(&self, other: &Self) -> Self
pub fn mul_scalar(&self, other: &B::Elem) -> Self
pub fn div(&self, other: &Self) -> Self
pub fn div_scalar(&self, other: &B::Elem) -> Self
pub fn random(shape: Shape<D>, distribution: Distribution<B::Elem>) -> Self
pub fn mean(&self) -> Tensor<B, 1>
pub fn sum(&self) -> Tensor<B, 1>
pub fn mean_dim(&self, dim: usize) -> Self
pub fn sum_dim(&self, dim: usize) -> Self
pub fn equal(&self, other: &Self) -> BoolTensor<B, D>
pub fn equal_scalar(&self, other: &B::Elem) -> BoolTensor<B, D>
pub fn greater(&self, other: &Self) -> BoolTensor<B, D>
pub fn greater_equal(&self, other: &Self) -> BoolTensor<B, D>
pub fn greater_scalar(&self, other: &B::Elem) -> BoolTensor<B, D>
pub fn greater_equal_scalar(&self, other: &B::Elem) -> BoolTensor<B, D>
pub fn lower(&self, other: &Self) -> BoolTensor<B, D>
pub fn lower_equal(&self, other: &Self) -> BoolTensor<B, D>
pub fn lower_scalar(&self, other: &B::Elem) -> BoolTensor<B, D>
pub fn lower_equal_scalar(&self, other: &B::Elem) -> BoolTensor<B, D>
pub fn zeros(shape: Shape<D>) -> Self
pub fn ones(shape: Shape<D>) -> Self
pub fn from_data(data: Data<B::Elem, D>) -> Self
pub fn from_data_device(data: Data<B::Elem, D>, device: B::Device) -> Self
pub fn index<const D2: usize>(&self, indexes: [Range<usize>; D2]) -> Self
pub fn index_assign<const D2: usize>(
&self,
indexes: [Range<usize>; D2],
values: &Self
) -> Self
pub fn mask_fill(&self, mask: &BoolTensor<B, D>, value: B::Elem) -> Self
pub fn to_full_precision(&self) -> Tensor<B::FullPrecisionBackend, D>
pub fn from_full_precision(tensor: Tensor<B::FullPrecisionBackend, D>) -> Self
pub fn argmax(&self, dim: usize) -> Tensor<B::IntegerBackend, D>
pub fn argmin(&self, dim: usize) -> Tensor<B::IntegerBackend, D>
pub fn cat(tensors: Vec<Self>, dim: usize) -> Self
pub fn unsqueeze<const D2: usize>(&self) -> Tensor<B, D2>
sourceimpl<const D: usize, B: ADBackend> Tensor<B, D>
impl<const D: usize, B: ADBackend> Tensor<B, D>
pub fn backward(&self) -> Gradients
pub fn grad(&self, grads: &Gradients) -> Option<Tensor<B::InnerBackend, D>>
pub fn inner(&self) -> Tensor<B::InnerBackend, D>
pub fn update(&mut self, other_inner: Tensor<B::InnerBackend, D>)
pub fn from_inner(inner: Tensor<B::InnerBackend, D>) -> Self
pub fn detach(&self) -> Self
Trait Implementations
sourceimpl<B: Clone + Backend, const D: usize> Clone for Tensor<B, D>where
B::TensorPrimitive<D>: Clone,
impl<B: Clone + Backend, const D: usize> Clone for Tensor<B, D>where
B::TensorPrimitive<D>: Clone,
sourceimpl<B: Debug + Backend, const D: usize> Debug for Tensor<B, D>where
B::TensorPrimitive<D>: Debug,
impl<B: Debug + Backend, const D: usize> Debug for Tensor<B, D>where
B::TensorPrimitive<D>: Debug,
Auto Trait Implementations
impl<B, const D: usize> RefUnwindSafe for Tensor<B, D>where
<B as Backend>::TensorPrimitive<D>: RefUnwindSafe,
impl<B, const D: usize> Send for Tensor<B, D>
impl<B, const D: usize> Sync for Tensor<B, D>
impl<B, const D: usize> Unpin for Tensor<B, D>where
<B as Backend>::TensorPrimitive<D>: Unpin,
impl<B, const D: usize> UnwindSafe for Tensor<B, D>where
<B as Backend>::TensorPrimitive<D>: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more