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