| 47 | // &tensor(i, ...)) is multiple of EIGEN_MAX_ALIGN_BYTES. |
| 48 | template <typename T> |
| 49 | bool IsInnerDimsSizeAligned(const TensorShape& s) { |
| 50 | if (s.dims() == 0) return false; |
| 51 | const int64 dim0_size = s.dim_size(0); |
| 52 | if (dim0_size == 0) return false; |
| 53 | #if EIGEN_MAX_ALIGN_BYTES == 0 |
| 54 | return true; |
| 55 | #else |
| 56 | const int64 bytes_per_dim0 = (s.num_elements() / dim0_size) * sizeof(T); |
| 57 | return bytes_per_dim0 % EIGEN_MAX_ALIGN_BYTES == 0; |
| 58 | #endif |
| 59 | } |
| 60 | |
| 61 | // Given a shape 's' of a tensor of type T and the `start` and `end` index of a |
| 62 | // dim 0 slice, returns true iff slice is aligned with respect to original |
nothing calls this directly
no test coverage detected