| 192 | } |
| 193 | |
| 194 | StatusOr<DLDeviceType> DLDeviceTypeForDevice(const Device& device) { |
| 195 | const se::Platform* platform = |
| 196 | device.local_device_state()->executor()->platform(); |
| 197 | if (platform->id() == se::host::kHostPlatformId) { |
| 198 | return kDLCPU; |
| 199 | } else if (platform->id() == se::cuda::kCudaPlatformId) { |
| 200 | return kDLGPU; |
| 201 | } |
| 202 | return InvalidArgument("Device %s cannot be used as a DLPack device.", |
| 203 | device.DebugString()); |
| 204 | } |
| 205 | |
| 206 | StatusOr<DLContext> DLContextForDevice(const Device& device) { |
| 207 | DLContext context; |
no test coverage detected