burn-tensor 0.1.0

This library provides multiple tensor implementations hidden behind an easy to use API that supports reverse mode automatic differentiation.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::tensor::{backend::tch::TchTensor, ops::*, Shape};

impl<P: tch::kind::Element, const D: usize> TensorOpsMatmul<P, D> for TchTensor<P, D> {
    fn matmul(&self, other: &Self) -> Self {
        let tensor = self.tensor.matmul(&other.tensor);
        let kind = self.kind.clone();
        let shape = Shape::from(tensor.size());

        Self {
            kind,
            tensor,
            shape,
        }
    }
}