This commit adds stream operator for Index
#include <initializer_list>
#include <vector>
#include <cstdint>
+#include <ostream>
namespace nncc
{
std::vector<uint32_t> _indices;
};
+std::ostream &operator<<(std::ostream &s, const Index &sh);
+
} // namespace data
} // namespace core
} // namespace contrib
uint32_t &Index::at(uint32_t axis) { return _indices.at(axis); }
uint32_t Index::at(uint32_t axis) const { return _indices.at(axis); }
+std::ostream &operator<<(std::ostream &s, const Index &sh)
+{
+ s << "[ ";
+ for (uint32_t i = 0; i < sh.rank(); ++i)
+ {
+ if (i != 0 )
+ s << ", ";
+ s << sh.at(i);
+ }
+ s << "]";
+
+ return s;
+}
+
} // namespace data
} // namespace core
} // namespace contrib