| 49 | |
| 50 | template <typename IndexValueType> |
| 51 | Status CheckSparseIndexMaximumValue(const std::vector<int64_t>& shape) { |
| 52 | using c_index_value_type = typename IndexValueType::c_type; |
| 53 | constexpr int64_t type_max = |
| 54 | static_cast<int64_t>(std::numeric_limits<c_index_value_type>::max()); |
| 55 | auto greater_than_type_max = [&](int64_t x) { return x > type_max; }; |
| 56 | if (std::any_of(shape.begin(), shape.end(), greater_than_type_max)) { |
| 57 | return Status::Invalid("The bit width of the index value type is too small"); |
| 58 | } |
| 59 | return Status::OK(); |
| 60 | } |
| 61 | |
| 62 | template <> |
| 63 | Status CheckSparseIndexMaximumValue<Int64Type>(const std::vector<int64_t>& shape) { |
no test coverage detected