TensorShape class
#include <FAST/Data/TensorShape.hpp>
Object representing the shape of a Tensor.
Contents
Constructors, destructors, conversion operators
- TensorShape(std::initializer_list<int> dimensions)
- TensorShape(VectorXi dimensions) explicit
- TensorShape(const TensorShape& other)
- TensorShape(std::vector<int> dimensions = std::vector<int>()) explicit
Public functions
- auto operator=(const TensorShape& other) -> TensorShape&
- auto empty() const -> bool
- auto getTotalSize() const -> int
- auto getDimensions() const -> int
- auto getKnownDimensions() const -> int
- auto getUnknownDimensions(bool excludingFirstDimension = false) const -> int
- Get nr of unknown dimensions (dimensions that are -1)
- auto getAll() const -> std::vector<int>
- Get all dimensions as vector.
- auto operator[](int i) -> int&
- auto operator[](int i) const -> const int&
- void setDimension(int i, int value)
- void addDimension(int value)
- void insertDimension(int position, int value)
- auto toString() const -> std::string
- void deleteDimension(int index)
- void deleteDimensions(int startIndex, int endIndex)
Friends
- auto operator==(const TensorShape& a, const TensorShape& b) -> FAST_EXPORT friend bool
- auto operator!=(const TensorShape& a, const TensorShape& b) -> FAST_EXPORT friend bool
Function documentation
fast:: TensorShape:: TensorShape(std::initializer_list<int> dimensions)
| Parameters | |
|---|---|
| dimensions | |
Construct tensor shape
fast:: TensorShape:: TensorShape(VectorXi dimensions) explicit
| Parameters | |
|---|---|
| dimensions | |
Construct tensor shape
fast:: TensorShape:: TensorShape(std::vector<int> dimensions = std::vector<int>()) explicit
| Parameters | |
|---|---|
| dimensions | |
Construct tensor shape
TensorShape& fast:: TensorShape:: operator=(const TensorShape& other)
| Parameters | |
|---|---|
| other | |
Assignment constructor
bool fast:: TensorShape:: empty() const
If shape is empty or not
int fast:: TensorShape:: getTotalSize() const
Total size of tensor, excluding any unknown dimensions
int fast:: TensorShape:: getDimensions() const
Get nr of dimensions
int fast:: TensorShape:: getKnownDimensions() const
Get nr of known dimensions (dimension not -1)
int fast:: TensorShape:: getUnknownDimensions(bool excludingFirstDimension = false) const
Get nr of unknown dimensions (dimensions that are -1)
| Parameters | |
|---|---|
| excludingFirstDimension | Get nr of unknown dimensions, excluding the first dimension (batch dimension) |
void fast:: TensorShape:: addDimension(int value)
| Parameters | |
|---|---|
| value | |
Add a dimension to the end of the shape with value
void fast:: TensorShape:: insertDimension(int position,
int value)
| Parameters | |
|---|---|
| position | |
| value | |
Insert a new dimension at a given position with the given value
std::string fast:: TensorShape:: toString() const
Convert shape into string
void fast:: TensorShape:: deleteDimensions(int startIndex,
int endIndex)
| Parameters | |
|---|---|
| startIndex | |
| endIndex | |
Delete a range of dimensions