Class to store and perform operations on 1D Tensors, aka vectors, suitable for use in feed-forward neural networks.
More...
#include <TensorOneD.hpp>
Class to store and perform operations on 1D Tensors, aka vectors, suitable for use in feed-forward neural networks.
◆ TensorOneD() [1/6]
geopm::TensorOneD::TensorOneD |
( |
| ) |
|
◆ TensorOneD() [2/6]
geopm::TensorOneD::TensorOneD |
( |
size_t |
n | ) |
|
Constructor with size specified.
- Parameters
-
◆ TensorOneD() [3/6]
geopm::TensorOneD::TensorOneD |
( |
const TensorOneD & |
other | ) |
|
Constructs a deep copy of the argument.
- Parameters
-
◆ TensorOneD() [4/6]
geopm::TensorOneD::TensorOneD |
( |
TensorOneD && |
other | ) |
|
◆ TensorOneD() [5/6]
geopm::TensorOneD::TensorOneD |
( |
const std::vector< double > & |
input | ) |
|
Constructor from vector of values.
- Parameters
-
[in] | input | The values to store in the 1D tensor. |
- Exceptions
-
geopm::Exception | if input is empty. |
◆ TensorOneD() [6/6]
geopm::TensorOneD::TensorOneD |
( |
const std::vector< double > & |
input, |
|
|
std::shared_ptr< TensorMath > |
math |
|
) |
| |
Test constructor.
- Parameters
-
[in] | input | The values to store in the 1D tensor. |
[in] | math | TensorMath instance |
- Exceptions
-
geopm::Exception | if input is empty. |
◆ ~TensorOneD()
virtual geopm::TensorOneD::~TensorOneD |
( |
| ) |
|
|
virtualdefault |
◆ get_data()
const std::vector< double > & geopm::TensorOneD::get_data |
( |
| ) |
const |
Return the tensor as a vector of doubles.
- Returns
- Returns the contents of the tensor.
◆ get_dim()
size_t geopm::TensorOneD::get_dim |
( |
| ) |
const |
Get the length of the 1D tensor.
- Returns
- Returns the length of the 1D tensor
◆ operator*()
double geopm::TensorOneD::operator* |
( |
const TensorOneD & |
other | ) |
const |
◆ operator+()
◆ operator-()
◆ operator=() [1/2]
Overload = operator with an in-place deep copy.
- Parameters
-
[in] | other | The assignee (tensor to be copied) |
◆ operator=() [2/2]
◆ operator==()
bool geopm::TensorOneD::operator== |
( |
const TensorOneD & |
other | ) |
const |
Overload == operator to do comparison of the underlying.
- Parameters
-
[in] | other | The tensor to compare against |
◆ operator[]() [1/2]
double & geopm::TensorOneD::operator[] |
( |
size_t |
idx | ) |
|
Reference indexing of 1D tensor value at idx.
- 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]
double geopm::TensorOneD::operator[] |
( |
size_t |
idx | ) |
const |
Value access of 1D Tensor value at idx.
- Parameters
-
[in] | idx | The index at which to look for the value |
- Returns
- Returns the value of the 1D tensor at idx
◆ set_dim()
void geopm::TensorOneD::set_dim |
( |
size_t |
dim | ) |
|
Set length of 1D tensor.
If the instance has more than n elements, it will be truncated. If it has fewer than n elements, the tensor will be expanded to a total size of n, uninitialized.
- Parameters
-
[in] | n | Resulting size of 1D tensor |
◆ sigmoid()
The documentation for this class was generated from the following files: