XPUDevice.h 521 B

123456789101112131415161718
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. #pragma once
  3. #include <ATen/Context.h>
  4. #include <c10/xpu/XPUFunctions.h>
  5. namespace at::xpu {
  6. inline Device getDeviceFromPtr(void* ptr) {
  7. auto device = c10::xpu::get_device_idx_from_pointer(ptr);
  8. return {c10::DeviceType::XPU, device};
  9. }
  10. } // namespace at::xpu
  11. #else
  12. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  13. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)