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> TensorOpsTranspose<P, D> for TchTensor<P, D> {
    fn transpose(&self) -> Self {
        let tensor = self.tensor.transpose(-2, -1);
        let kind = self.kind.clone();
        let shape = Shape::from(tensor.size());

        Self {
            kind,
            tensor,
            shape,
        }
    }
}