Overview

The Shape structure is used to describe the shape of a tensor and contains the following information:

size_t dim_num_;
int64_t dims_[kMaxDimNum];

dim_num_ indicates the number of dimensions of the shape, and dims_array indicates the specific shape of a tensor.

Header Files to Be Included

1
#include <shape.h>

Public Member Functions

Shape() : dim_num_(0), dims_{0}
Shape(const std::initializer_list<int64_t> &args) : Shape()
Shape(const Shape &other)
Shape &operator=(const Shape &other)
bool operator==(const Shape &rht) const
bool operator!=(const Shape &rht) const
const int64_t &operator[](const size_t idx) const
int64_t &operator[](const size_t idx)
int64_t GetShapeSize() const
bool IsScalar() const
void SetScalar()
size_t GetDimNum() const
void SetDimNum(const size_t dim_num)
int64_t GetDim(const size_t idx) const
void SetDim(size_t idx, const int64_t dim_value)
Shape& AppendDim(const int64_t value)