| 243 | } // namespace |
| 244 | |
| 245 | Result<DLManagedTensor*> ExportTensor(const std::shared_ptr<Tensor>& t) { |
| 246 | // Legacy DLPack is not implemented initially for immutable tensor. |
| 247 | // We prefer users to over to the non-legacy DLPack rather than adding new behaviour. |
| 248 | if (!t->is_mutable()) { |
| 249 | return Status::NotImplemented( |
| 250 | "Legacy DLPack support is not implemented for immutable tensors." |
| 251 | " Please move to the DLPack version >=1.0"); |
| 252 | } |
| 253 | return ExportTensorImpl<DLManagedTensor>(t, /* copy= */ false); |
| 254 | } |
| 255 | |
| 256 | Result<DLManagedTensorVersioned*> ExportTensorVersioned(const std::shared_ptr<Tensor>& t, |
| 257 | bool copy) { |