| 1346 | |
| 1347 | template <typename DataType> |
| 1348 | bool FloatSparseTensorDataEquals(const typename DataType::c_type* left_data, |
| 1349 | const typename DataType::c_type* right_data, |
| 1350 | const int64_t length, const EqualOptions& opts) { |
| 1351 | using c_type = typename DataType::c_type; |
| 1352 | static_assert(std::is_floating_point<c_type>::value, |
| 1353 | "DataType must be a floating point type"); |
| 1354 | if (opts.nans_equal()) { |
| 1355 | if (left_data == right_data) { |
| 1356 | return true; |
| 1357 | } |
| 1358 | |
| 1359 | for (int64_t i = 0; i < length; ++i) { |
| 1360 | const auto left = left_data[i]; |
| 1361 | const auto right = right_data[i]; |
| 1362 | if (left != right && !(std::isnan(left) && std::isnan(right))) { |
| 1363 | return false; |
| 1364 | } |
| 1365 | } |
| 1366 | } else { |
| 1367 | for (int64_t i = 0; i < length; ++i) { |
| 1368 | if (left_data[i] != right_data[i]) { |
| 1369 | return false; |
| 1370 | } |
| 1371 | } |
| 1372 | } |
| 1373 | return true; |
| 1374 | } |
| 1375 | |
| 1376 | template <typename SparseIndexType> |
| 1377 | struct SparseTensorEqualsImpl<SparseIndexType, SparseIndexType> { |
nothing calls this directly
no outgoing calls
no test coverage detected