| 216 | } // namespace |
| 217 | |
| 218 | Result<std::shared_ptr<Tensor>> MakeTensorFromSparseCSRMatrix( |
| 219 | MemoryPool* pool, const SparseCSRMatrix* sparse_tensor) { |
| 220 | const auto& sparse_index = |
| 221 | internal::checked_cast<const SparseCSRIndex&>(*sparse_tensor->sparse_index()); |
| 222 | const auto& indptr = sparse_index.indptr(); |
| 223 | const auto& indices = sparse_index.indices(); |
| 224 | const auto non_zero_length = sparse_tensor->non_zero_length(); |
| 225 | return MakeTensorFromSparseCSXMatrix( |
| 226 | SparseMatrixCompressedAxis::ROW, pool, indptr, indices, non_zero_length, |
| 227 | sparse_tensor->type(), sparse_tensor->shape(), sparse_tensor->size(), |
| 228 | sparse_tensor->raw_data(), sparse_tensor->dim_names()); |
| 229 | } |
| 230 | |
| 231 | Result<std::shared_ptr<Tensor>> MakeTensorFromSparseCSCMatrix( |
| 232 | MemoryPool* pool, const SparseCSCMatrix* sparse_tensor) { |
no test coverage detected