13 #define DBG_PRINT_2D_TENSOR(s, m) std::cout << s << std::endl; \
14 for(unsigned r = 0; r < m.getDims()[0]; ++r){ \
15 for(unsigned c = 0; c < m.getDims()[1]; ++c){ \
16 std::cout << m(r, c); \
17 if(c < m.getDims()[1] - 1) std::cout << ", "; \
19 std::cout << std::endl; \
22 #define DBG_PRINT_1D_TENSOR(s, v) std::cout << s << std::endl; \
23 for(unsigned i = 0; i < v.getDims()[0]; ++i){ \
25 if(i < v.getDims()[0] - 1) std::cout << ", "; \
27 std::cout << std::endl
29 #define DBG_PRINT_2D_TENSOR(_, _)
30 #define DBG_PRINT_1D_TENSOR(_, _)
33 #define MAX_SHOWN_ENTRIES (unsigned)20
48 Tensor(
const std::vector<unsigned> dims);
56 Tensor(
const std::vector<unsigned> dims,
const std::vector<T> data);
64 Tensor(
const std::vector<unsigned> dims,
const T& defaultValue);
88 inline T&
operator()(
const int row,
const int col)
const;
98 inline T&
operator()(
const int row,
const int col,
const int offset)
const;
116 const unsigned getSize()
const;
123 const std::vector<unsigned>
getDims()
const;
131 std::vector<unsigned> dims;
134 std::shared_ptr<T[]> data;
Tensor()
Definition: Tensor.hpp:41
const unsigned getSize() const
Definition: Tensor.tpp:62
Tensor< T > & operator=(const Tensor< T > &rhs)
Definition: Tensor.tpp:54
T & operator()(const int i) const
Definition: Tensor.tpp:42
Definition: Tensor.hpp:37
const std::vector< unsigned > getDims() const
Definition: Tensor.tpp:66