Nabla  1.0
Nabla - a DSL for Automatic differentiation
Tensor.h
Go to the documentation of this file.
1 #ifndef TENSOR_H
2 #define TENSOR_H
3 
4 #include<vector>
5 #include<utility>
6 #include<iostream>
7 #include<set>
8 #include<map>
9 #include <vector>
10 
11 namespace nb{
12 class Tensor{
13  public:
14  int num_dims = 2;
15  int m;
16  int n;
17  std::vector<std::vector<double>> data;
18  Tensor();
19  Tensor (int m, int n);
20  Tensor (int m, int n, std::vector<std::vector<double>> vals);
21  Tensor transpose();
22  Tensor negative();
23 
24  void print();
25  std::pair<int, int> shape();
26 };
27 
29 Tensor add(Tensor a, Tensor b);
30 Tensor mul(double a, Tensor b);
31 Tensor mul(Tensor a, Tensor b);
32 double full_sum(Tensor a);
33 
34 };
35 
36 #endif
nb::full_sum
double full_sum(Tensor a)
Definition: Tensor.cpp:116
nb
Definition: Dtypes.h:8
nb::Tensor::data
std::vector< std::vector< double > > data
Definition: Tensor.h:17
nb::Tensor::n
int n
Definition: Tensor.h:16
nb::Tensor::num_dims
int num_dims
Definition: Tensor.h:14
nb::Tensor::m
int m
Definition: Tensor.h:15
nb::Tensor
Definition: Tensor.h:12
nb::mul
Tensor mul(double a, Tensor b)
Definition: Tensor.cpp:96
nb::Tensor::shape
std::pair< int, int > shape()
Definition: Tensor.cpp:47
nb::Tensor::print
void print()
Definition: Tensor.cpp:37
nb::matmul
Tensor matmul(Tensor a, Tensor b)
Definition: Tensor.cpp:73
nb::add
Tensor add(Tensor a, Tensor b)
Definition: Tensor.cpp:86
nb::Tensor::Tensor
Tensor()
Definition: Tensor.cpp:32
nb::Tensor::transpose
Tensor transpose()
Definition: Tensor.cpp:53
nb::Tensor::negative
Tensor negative()
Definition: Tensor.cpp:63