Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensor/src/core/ops/binary.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::broadcast::{compute_broadcast_shape_and_strides, is_broadcastable};
use crate::core::utils::unravel_index;
use crate::core::{TensorError, Numeric};
use crate::core::{Numeric, TensorError};
use crate::Tensor;

impl<T: Numeric> Tensor<T> {
Expand Down
2 changes: 1 addition & 1 deletion tensor/src/core/ops/movement.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::core::{calculate_strides, TensorError, Numeric};
use crate::core::{calculate_strides, Numeric, TensorError};
use crate::Tensor;

impl<T: Numeric> Tensor<T> {
Expand Down
2 changes: 1 addition & 1 deletion tensor/src/core/ops/reduce.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::core::utils::unravel_index;
use crate::core::{TensorError, Numeric};
use crate::core::{Numeric, TensorError};
use crate::Tensor;

impl<T: Numeric> Tensor<T> {
Expand Down
2 changes: 1 addition & 1 deletion tensor/src/core/ops/unary.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Tensor, core::Numeric};
use crate::{core::Numeric, Tensor};

impl<T: Numeric> Tensor<T> {
fn unary_op<F>(&self, op: F) -> Tensor<T>
Expand Down
7 changes: 2 additions & 5 deletions tensor/src/core/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ impl<T: Numeric> Add<T> for &Tensor<T> {
}
}


impl<T: Numeric> AddAssign<&Tensor<T>> for Tensor<T> {
fn add_assign(&mut self, rhs: &Tensor<T>) {
if *self.shape() != *rhs.shape() {
Expand Down Expand Up @@ -100,7 +99,6 @@ impl<T: Numeric> Sub<T> for &Tensor<T> {
}
}


impl<T: Numeric> SubAssign<&Tensor<T>> for Tensor<T> {
fn sub_assign(&mut self, rhs: &Tensor<T>) {
if *self.shape() != *rhs.shape() {
Expand Down Expand Up @@ -143,11 +141,10 @@ impl<T: Numeric> Mul<T> for &Tensor<T> {
}
}


impl<T: Numeric> MulAssign<&Tensor<T>> for Tensor<T> {
fn mul_assign(&mut self, rhs: &Tensor<T>) {
if *self.shape() != *rhs.shape() {
panic!("The tensor shape not compatible for inplace subtraction")
panic!("The tensor shape not compatible for inplace multiplication")
}
self.data
.iter_mut()
Expand Down Expand Up @@ -189,7 +186,7 @@ impl<T: Numeric> Div<T> for &Tensor<T> {
impl<T: Numeric> DivAssign<&Tensor<T>> for Tensor<T> {
fn div_assign(&mut self, rhs: &Tensor<T>) {
if *self.shape() != *rhs.shape() {
panic!("The tensor shape not compatible for inplace subtraction")
panic!("The tensor shape not compatible for inplace division")
}
self.data
.iter_mut()
Expand Down
2 changes: 1 addition & 1 deletion tensor/src/core/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::fmt;
use crate::core::Numeric;
use std::fmt;

pub fn calculate_strides(shape: &[usize]) -> Vec<usize> {
let length: usize = shape.len();
Expand Down