| 174 | |
| 175 | template <typename T> |
| 176 | Result<DLDevice> ExportDeviceImpl(const std::shared_ptr<T>& a) { |
| 177 | // ArrayData reports the device of its buffers and children |
| 178 | if (a->data()->device_type() == DeviceAllocationType::kCPU) { |
| 179 | return {{.device_type = DLDeviceType::kDLCPU, .device_id = 0}}; |
| 180 | } else { |
| 181 | return Status::NotImplemented( |
| 182 | "DLPack support is implemented only for buffers on CPU device."); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | } // namespace |
| 187 |
no test coverage detected