1 #pragma once 2 3 #include <ATen/Context.h> 4 #include <c10/xpu/XPUFunctions.h> 5 6 namespace at::xpu { 7 getDeviceFromPtr(void * ptr)8inline Device getDeviceFromPtr(void* ptr) { 9 auto device = c10::xpu::get_device_idx_from_pointer(ptr); 10 return {c10::DeviceType::XPU, device}; 11 } 12 13 } // namespace at::xpu 14