| 123 | namespace { |
| 124 | |
| 125 | inline Status CheckSparseCOOIndexValidity(const std::shared_ptr<DataType>& type, |
| 126 | const std::vector<int64_t>& shape, |
| 127 | const std::vector<int64_t>& strides) { |
| 128 | if (!is_integer(type->id())) { |
| 129 | return Status::TypeError("Type of SparseCOOIndex indices must be integer"); |
| 130 | } |
| 131 | if (shape.size() != 2) { |
| 132 | return Status::Invalid("SparseCOOIndex indices must be a matrix"); |
| 133 | } |
| 134 | |
| 135 | RETURN_NOT_OK(internal::CheckSparseIndexMaximumValue(type, shape)); |
| 136 | |
| 137 | if (!internal::IsTensorStridesContiguous(type, shape, strides)) { |
| 138 | return Status::Invalid("SparseCOOIndex indices must be contiguous"); |
| 139 | } |
| 140 | return Status::OK(); |
| 141 | } |
| 142 | |
| 143 | void GetCOOIndexTensorRow(const std::shared_ptr<Tensor>& coords, const int64_t row, |
| 144 | std::vector<int64_t>* out_index) { |
no test coverage detected