| 910 | |
| 911 | template <typename NativeT> |
| 912 | void LiteralBase::EachCell( |
| 913 | std::function<void(absl::Span<const int64> indices, NativeT value)> |
| 914 | per_cell) const { |
| 915 | if (ShapeUtil::IsZeroElementArray(shape())) { |
| 916 | return; |
| 917 | } |
| 918 | std::vector<int64> indices(shape().rank(), 0); |
| 919 | do { |
| 920 | per_cell(indices, Get<NativeT>(indices)); |
| 921 | } while (IndexUtil::BumpIndices(shape(), absl::MakeSpan(indices))); |
| 922 | } |
| 923 | |
| 924 | template <typename NativeT> |
| 925 | inline void MutableLiteralBase::PopulateR1(absl::Span<const NativeT> values) { |