pub struct Tensor { /* private fields */ }Implementations§
Source§impl Tensor
impl Tensor
pub fn new(tensor: TensorStorage, requires_grad: bool) -> Self
pub fn tensor(&self) -> &TensorStorage
pub fn tensor_mut(&mut self) -> &mut TensorStorage
pub fn requires_grad(&self) -> &bool
pub fn grad_fn(&self) -> Option<Rc<dyn GradientFunction>>
pub fn set_grad_fn(&mut self, grad_fn: Option<Rc<dyn GradientFunction>>)
pub fn grad(&self) -> Option<Rc<RefCell<TensorStorage>>>
pub fn backward(&mut self)
Trait Implementations§
Source§impl TensorCreation for Tensor
impl TensorCreation for Tensor
Source§impl TensorOps for Tensor
impl TensorOps for Tensor
fn add_tensor(&self, other: &Self) -> Self
fn mul_tensor(&self, other: &Self) -> Self
fn sum(&self) -> Self
fn mean(&self) -> Self
fn product(&self) -> Self
fn sub_tensor(&self, other: &Self) -> Self
fn div_tensor(&self, other: &Self) -> Self
fn add_f32(&self, other: f32) -> Self
fn sub_f32(&self, other: f32) -> Self
fn mul_f32(&self, other: f32) -> Self
fn div_f32(&self, other: f32) -> Self
fn add_tensor_assign(&mut self, other: &Self)
fn sub_tensor_assign(&mut self, other: &Self)
fn mul_tensor_assign(&mut self, other: &Self)
fn div_tensor_assign(&mut self, other: &Self)
fn add_f32_assign(&mut self, other: f32)
fn sub_f32_assign(&mut self, other: f32)
fn mul_f32_assign(&mut self, other: f32)
fn div_f32_assign(&mut self, other: f32)
fn matmul(&self, other: &Self) -> Self
Source§impl TensorShape for Tensor
impl TensorShape for Tensor
fn reshape(&mut self, new_shape: Vec<usize>)
fn transpose(&mut self)
fn permute(&mut self, dims: &[usize])
fn flatten(&mut self)
fn squeeze(&mut self)
fn unsqueeze(&mut self, dim: usize)
fn broadcast(&self, new_shape: &[usize]) -> Self
fn compute_broadcast_shape(&self, target_shape: &[usize]) -> Vec<usize>
fn compute_broadcast_strides(&self, broadcast_shape: &[usize]) -> Vec<usize>
fn pad_shape(&self, target_rank: usize) -> Vec<usize>
fn broadcast_tensors(a: &Self, b: &Self) -> (Self, Self)
Auto Trait Implementations§
impl Freeze for Tensor
impl !RefUnwindSafe for Tensor
impl !Send for Tensor
impl !Sync for Tensor
impl Unpin for Tensor
impl !UnwindSafe for Tensor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more