Fills the array with a pattern of values of the form: (rowno << log2ceil(width) | colno) + start_value This makes it easy to see distinct row/column values in the array.
| 77 | // |
| 78 | // This makes it easy to see distinct row/column values in the array. |
| 79 | void FillUnique(T start_value = 0) { |
| 80 | for (int64 i0 = 0; i0 < n1(); ++i0) { |
| 81 | for (int64 i1 = 0; i1 < n2(); ++i1) { |
| 82 | (*this)(i0, i1) = |
| 83 | ((i0 << tensorflow::Log2Ceiling64(n2())) | i1) + start_value; |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | // Applies f to all cells in this array, in row-major order. |
| 89 | void Each(std::function<void(int64, int64, T*)> f) { |