17#ifndef __LOCO_IR_TENSOR_SHAPE_H__
18#define __LOCO_IR_TENSOR_SHAPE_H__
22#include <initializer_list>
32 TensorShape(std::initializer_list<Dimension> dims) : _dims(dims.
begin(), dims.end()) {}
35 uint32_t
rank(
void)
const {
return _dims.size(); }
36 void rank(uint32_t r) { _dims.resize(r); }
38 const Dimension &
dim(uint32_t axis)
const {
return _dims.at(axis); }
42 std::vector<Dimension> _dims;
63bool operator==(
const TensorShape &lhs,
const TensorShape &rhs);
The value of one dimension in a tensor shape.
const Dimension & dim(uint32_t axis) const
Dimension & dim(uint32_t axis)
TensorShape(std::initializer_list< Dimension > dims)
uint32_t rank(void) const
bool operator==(const Dimension &, const Dimension &)
Equality operator between two Dimensions.
uint32_t element_count(const loco::TensorShape *tensor_shape)
Return the number of elements in a tensor of given shape.