| 87 | #undef CALL_CHECK_MAXIMUM_VALUE |
| 88 | |
| 89 | Status MakeSparseTensorFromTensor(const Tensor& tensor, |
| 90 | SparseTensorFormat::type sparse_format_id, |
| 91 | const std::shared_ptr<DataType>& index_value_type, |
| 92 | MemoryPool* pool, |
| 93 | std::shared_ptr<SparseIndex>* out_sparse_index, |
| 94 | std::shared_ptr<Buffer>* out_data) { |
| 95 | switch (sparse_format_id) { |
| 96 | case SparseTensorFormat::COO: |
| 97 | return MakeSparseCOOTensorFromTensor(tensor, index_value_type, pool, |
| 98 | out_sparse_index, out_data); |
| 99 | case SparseTensorFormat::CSR: |
| 100 | return MakeSparseCSXMatrixFromTensor(SparseMatrixCompressedAxis::ROW, tensor, |
| 101 | index_value_type, pool, out_sparse_index, |
| 102 | out_data); |
| 103 | case SparseTensorFormat::CSC: |
| 104 | return MakeSparseCSXMatrixFromTensor(SparseMatrixCompressedAxis::COLUMN, tensor, |
| 105 | index_value_type, pool, out_sparse_index, |
| 106 | out_data); |
| 107 | case SparseTensorFormat::CSF: |
| 108 | return MakeSparseCSFTensorFromTensor(tensor, index_value_type, pool, |
| 109 | out_sparse_index, out_data); |
| 110 | |
| 111 | // LCOV_EXCL_START: ignore program failure |
| 112 | default: |
| 113 | return Status::Invalid("Invalid sparse tensor format"); |
| 114 | // LCOV_EXCL_STOP |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | } // namespace internal |
| 119 |
no test coverage detected