Coordinate of a row-major logical index.
- Returns
- The coordinate, or empty when the index is past the last element.
Implements MayaFlux::Kakshya::NDDataContainer< TensorData >.
Definition at line 212 of file TensorContainer.cpp.
213{
214 const auto& shape =
m_data.spec().shape;
216 return {};
217
218 std::vector<uint64_t> coordinates(shape.size());
219 for (size_t axis = shape.size(); axis-- > 0;) {
220 coordinates[axis] = linear_index % shape[axis];
221 linear_index /= shape[axis];
222 }
223 return coordinates;
224}
uint64_t get_total_elements() const override
Number of elements in the tensor.
References get_total_elements(), and m_data.