| 148 | // Initializes everything in the given tensor to the given value. |
| 149 | template <typename T> |
| 150 | void Initialize(Tensor counts, T val = 0) { |
| 151 | auto flat = counts.unaligned_flat<T>(); |
| 152 | std::fill(flat.data(), flat.data() + flat.size(), val); |
| 153 | } |
| 154 | |
| 155 | // Returns a function that accesses the (i,j)-th element of the specified two |
| 156 | // dimensional tensor. |