Definition at line 31 of file tensor_gen.cpp.
◆ Tensor()
Tensor::Tensor |
( |
const vector< hsize_t > & |
shape | ) |
|
|
inlineexplicit |
Definition at line 34 of file tensor_gen.cpp.
34 : _shape(shape), _data(0), _num_elems(1)
35 {
36 _strides.resize(shape.size());
37
38 for (int i = _shape.size() - 1; i >= 0; --i)
39 {
40 _strides[i] = _num_elems;
41 _num_elems *= _shape[i];
42 }
43
44 _data = new float[_num_elems];
45 }
◆ ~Tensor()
◆ at()
float & Tensor::at |
( |
const vector< int > & |
coords | ) |
|
|
inline |
◆ data()
◆ dim()
int Tensor::dim |
( |
int |
d | ) |
const |
|
inline |
◆ numElems()
float Tensor::numElems |
( |
| ) |
const |
|
inline |
◆ rank()
int Tensor::rank |
( |
| ) |
const |
|
inline |
◆ transpose()
Tensor Tensor::transpose |
( |
const vector< hsize_t > & |
reshape | ) |
|
|
inline |
Definition at line 63 of file tensor_gen.cpp.
64 {
65 vector<hsize_t> tr_shape(_shape.size());
66
67 for (auto i = 0; i < _shape.size(); ++i)
68 tr_shape[i] = _shape[reshape[i]];
69
72 vector<int> tr_coords(_shape.size());
73
74 for (
int i = 0; i <
rank(); ++i)
75 tr_coords[i] =
coords[reshape[i]];
76
78 };
79 iterate(*this, on_loop);
81 }
float & at(const vector< int > &coords)
References at(), coords, and rank().
Referenced by main().
The documentation for this class was generated from the following file: