Class to manage data and operations related to 2D Tensors required for neural net inference.
More...
#include <TensorTwoD.hpp>
Class to manage data and operations related to 2D Tensors required for neural net inference.
◆ TensorTwoD() [1/9]
geopm::TensorTwoD::TensorTwoD |
( |
| ) |
|
◆ TensorTwoD() [2/9]
geopm::TensorTwoD::TensorTwoD |
( |
size_t |
rows, |
|
|
size_t |
cols |
|
) |
| |
Constructor setting dimensions.
◆ TensorTwoD() [3/9]
geopm::TensorTwoD::TensorTwoD |
( |
size_t |
rows, |
|
|
size_t |
cols, |
|
|
std::shared_ptr< TensorMath > |
math |
|
) |
| |
◆ TensorTwoD() [4/9]
geopm::TensorTwoD::TensorTwoD |
( |
const TensorTwoD & |
other | ) |
|
Copy constructor using a deep copy.
- Parameters
-
[in] | TensorTwoD& | 2D Tensor to copy |
◆ TensorTwoD() [5/9]
geopm::TensorTwoD::TensorTwoD |
( |
TensorTwoD && |
other | ) |
|
◆ TensorTwoD() [6/9]
geopm::TensorTwoD::TensorTwoD |
( |
const std::vector< std::vector< double > > & |
input | ) |
|
Constructor input from a vector of vectors of values.
- Parameters
-
[in] | input | std::vector<std::vector<double> > instance |
- Exceptions
-
geopm::Exception | if input is not rectangular or if input is empty. |
◆ TensorTwoD() [7/9]
geopm::TensorTwoD::TensorTwoD |
( |
const std::vector< std::vector< double > > & |
input, |
|
|
std::shared_ptr< TensorMath > |
math |
|
) |
| |
Constructor input from a vector of vectors of values.
- Parameters
-
[in] | input | std::vector<std::vector<double> > instance |
[in] | math | TensorMath instance |
- Exceptions
-
geopm::Exception | if input is not rectangular or if input is empty. |
◆ TensorTwoD() [8/9]
geopm::TensorTwoD::TensorTwoD |
( |
const std::vector< TensorOneD > & |
input | ) |
|
Constructor input from a vector of 1D tensors.
- Parameters
-
[in] | input | std::vector<TensorOneD> instance |
- Exceptions
-
geopm::Exception | if input is not rectangular or if input is empty. |
◆ TensorTwoD() [9/9]
geopm::TensorTwoD::TensorTwoD |
( |
const std::vector< TensorOneD > & |
input, |
|
|
std::shared_ptr< TensorMath > |
math |
|
) |
| |
Test constructor.
- Parameters
-
[in] | input | std::vector<TensorOneD> instance |
[in] | math | TensorMath instance |
- Exceptions
-
geopm::Exception | if input is not rectangular or if input is empty. |
◆ ~TensorTwoD()
virtual geopm::TensorTwoD::~TensorTwoD |
( |
| ) |
|
|
virtualdefault |
◆ get_cols()
size_t geopm::TensorTwoD::get_cols |
( |
| ) |
const |
get number of columns in 2D tensor
- Returns
- Number of columns in the 2D tensor
◆ get_data()
const std::vector< TensorOneD > & geopm::TensorTwoD::get_data |
( |
| ) |
const |
Return the tensor as a vector of tensors.
- Returns
- Returns the contents of the tensor.
◆ get_rows()
size_t geopm::TensorTwoD::get_rows |
( |
| ) |
const |
Get number of rows in the 2D tensor.
- Returns
- Number of rows of the 2D tensor
◆ operator*()
Multiply a 2D tensor by a 1D tensor.
- Parameters
-
[in] | TensorOneD& | Reference to the multiplicand |
- Exceptions
-
geopm::Exception | if the sizes are incompatible, i.e. if 2D tensor number of columns is unequal to 1D tensor number of rows |
◆ operator=() [1/2]
Oerload = operator with an in-place deep copy.
- Parameters
-
[in] | TensorTwoD& | Reference to the 2D Tensor to copy |
◆ operator=() [2/2]
◆ operator==()
bool geopm::TensorTwoD::operator== |
( |
const TensorTwoD & |
other | ) |
const |
Overload == operator to do comparison of the underlying.
- Parameters
-
[in] | other | The tensor to compare against |
◆ operator[]() [1/2]
TensorOneD & geopm::TensorTwoD::operator[] |
( |
size_t |
idx | ) |
|
Reference indexing of 1D Tensor at idx of the 2D Tensor.
- Parameters
-
[in] | idx | The index at which to look for the value |
- Returns
- Returns a reference to the 1D Tensor at idx
◆ operator[]() [2/2]
TensorOneD geopm::TensorTwoD::operator[] |
( |
size_t |
idx | ) |
const |
Value access of 1D Tensor value at idx.
@pram [in] idx The index at which to look for the value
- Returns
- Returns the values of 1D Tensors at idx
◆ set_data()
void geopm::TensorTwoD::set_data |
( |
const std::vector< TensorOneD > & |
data | ) |
|
Set the contents as a vector of tensors.
◆ set_dim()
void geopm::TensorTwoD::set_dim |
( |
size_t |
rows, |
|
|
size_t |
cols |
|
) |
| |
Set dimensions of 2D tensor.
- Parameters
-
[in] | rows | The number of "rows" or 1D tensors |
[in] | cols | The number of "cols" or the size of each 1D tensor |
If the instance contains more than rows
1D tensors, it will be truncated. If the instance contains fewer than rows
1D tensors, it will be expanded to a total number of rows, uninitialized. The individual 1D tensors will be managed similarly.
- Exceptions
-
geopm::Exception | if rows = 0 and cols > 0 |
The documentation for this class was generated from the following files: