20#include <initializer_list>
39 Shape(std::initializer_list<int32_t> &&dims) : _dims(
std::move(dims)) {}
41 explicit Shape(
const std::vector<int32_t> &dims) : _dims(
std::
begin(dims),
std::end(dims)) {}
43 int32_t
rank()
const {
return static_cast<int32_t
>(_dims.
size()); }
47 int32_t &
dim(int32_t axis)
noexcept
53 int32_t
dim(int32_t axis)
const noexcept
vector with cheap memory allocation
size_t size() const noexcept
Shape(const std::vector< int32_t > &dims)
int32_t & dim(int32_t axis) noexcept
int32_t numElements() const
bool operator==(const Shape &rhs) const
void resize(int32_t size)
bool operator!=(const Shape &rhs) const
static constexpr int32_t autoDim
int32_t dim(int32_t axis) const noexcept
Shape(std::initializer_list< int32_t > &&dims)
std::string toString(DataFormat data_format)
Shape broadcastShapes(const Shape &lhs_shape, const Shape &rhs_shape)
constexpr std::size_t wrap_index(std::int32_t index, std::size_t limit) noexcept