MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / DLDeviceTypeForDevice

Function DLDeviceTypeForDevice

tensorflow/compiler/xla/python/dlpack.cc:194–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194StatusOr<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
206StatusOr<DLContext> DLContextForDevice(const Device& device) {
207 DLContext context;

Callers 1

DLContextForDeviceFunction · 0.85

Calls 6

InvalidArgumentFunction · 0.85
local_device_stateMethod · 0.80
platformMethod · 0.45
executorMethod · 0.45
idMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected