| 1189 | namespace { |
| 1190 | |
| 1191 | bool StridedIntegerTensorContentEquals(const int dim_index, int64_t left_offset, |
| 1192 | int64_t right_offset, int elem_size, |
| 1193 | const Tensor& left, const Tensor& right) { |
| 1194 | const auto n = left.shape()[dim_index]; |
| 1195 | const auto left_stride = left.strides()[dim_index]; |
| 1196 | const auto right_stride = right.strides()[dim_index]; |
| 1197 | if (dim_index == left.ndim() - 1) { |
| 1198 | for (int64_t i = 0; i < n; ++i) { |
| 1199 | if (memcmp(left.raw_data() + left_offset + i * left_stride, |
| 1200 | right.raw_data() + right_offset + i * right_stride, elem_size) != 0) { |
| 1201 | return false; |
| 1202 | } |
| 1203 | } |
| 1204 | return true; |
| 1205 | } |
| 1206 | for (int64_t i = 0; i < n; ++i) { |
| 1207 | if (!StridedIntegerTensorContentEquals(dim_index + 1, left_offset, right_offset, |
| 1208 | elem_size, left, right)) { |
| 1209 | return false; |
| 1210 | } |
| 1211 | left_offset += left_stride; |
| 1212 | right_offset += right_stride; |
| 1213 | } |
| 1214 | return true; |
| 1215 | } |
| 1216 | |
| 1217 | bool IntegerTensorEquals(const Tensor& left, const Tensor& right) { |
| 1218 | bool are_equal; |
no test coverage detected