fast::TensorShape class

Object representing the shape of a Tensor.

Constructors, destructors, conversion operators

TensorShape(std::initializer_list<int> dimensions)
TensorShape(VectorXi dimensions)
TensorShape(std::vector<int> dimensions) explicit
TensorShape(const TensorShape& other)
TensorShape()

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() const -> int
auto getAll() const -> std::vector<int>
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)

Function documentation

fast::TensorShape::TensorShape(std::initializer_list<int> dimensions)

Parameters
dimensions

Construct tensor shape

fast::TensorShape::TensorShape(VectorXi dimensions)

Parameters
dimensions

Construct tensor shape

fast::TensorShape::TensorShape(std::vector<int> dimensions) explicit

Parameters
dimensions

Construct tensor shape

fast::TensorShape::TensorShape(const TensorShape& other)

Parameters
other

Copy constructor

fast::TensorShape::TensorShape()

Construct empty (invalid) 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() const

Get nr of unknown dimensions (dimensions that are -1)

std::vector<int> fast::TensorShape::getAll() const

Get all dimensions as vector

void fast::TensorShape::setDimension(int i, int value)

Parameters
i
value

Set dimension i to value

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::deleteDimension(int index)

Parameters
index

Delete a dimension

void fast::TensorShape::deleteDimensions(int startIndex, int endIndex)

Parameters
startIndex
endIndex

Delete a range of dimensions