37 for (uint32_t axis = 0; axis < lhs.
rank(); ++axis)
39 if (lhs.
dim(axis) != rhs.
dim(axis))
55 for (
const char *cur =
str.c_str();
true; ++cur)
57 if (*cur ==
',' || *cur ==
'\0')
74 assert(*cur >=
'0' && *cur <=
'9');
84uint64_t Shape::num_elements()
const
86 return std::accumulate(_dimensions.cbegin(), _dimensions.cend(), UINT64_C(1),
87 std::multiplies<uint64_t>());
96 for (uint32_t axis = 1; axis < shape.
rank(); ++axis)
98 os <<
"," << shape.
dim(axis);
Class to represent shape of a tensor.
int32_t dim(uint32_t n) const
Get specific dimension.
void append(int32_t d)
Add dimension to the back.
uint32_t rank(void) const
Get the rank of this shape.
bool operator==(const Shape &, const Shape &)
Check equality of two Shape.
std::ostream & operator<<(std::ostream &os, const IndexFormatter &fmt)
Send IndexFormatter object to output stream.
std::string str(Args &&...args)
This file contains nnfw::misc::tensor::Shape class.