redstone_ml/tensor/
equals.rs1use crate::{NdArray, Tensor, TensorDataType};
2
3impl<T: TensorDataType> PartialEq<Tensor<'_, T>> for Tensor<'_, T> {
4 fn eq(&self, other: &Tensor<T>) -> bool {
5 *self.array == *other.array
6 }
7}
8
9impl<T: TensorDataType> PartialEq<NdArray<'_, T>> for Tensor<'_, T> {
10 fn eq(&self, other: &NdArray<T>) -> bool {
11 *self.array == other
12 }
13}
14
15impl<T: TensorDataType> PartialEq<Tensor<'_, T>> for NdArray<'_, T> {
16 fn eq(&self, other: &Tensor<T>) -> bool {
17 self == *other.array
18 }
19}
20
21impl<T: TensorDataType> PartialEq<&Tensor<'_, T>> for NdArray<'_, T> {
22 fn eq(&self, other: &&Tensor<T>) -> bool {
23 self == *other.array
24 }
25}
26
27impl<T: TensorDataType> PartialEq<Tensor<'_, T>> for &NdArray<'_, T> {
28 fn eq(&self, other: &Tensor<T>) -> bool {
29 *self == *other.array
30 }
31}