intel / torch-xpu-ops

Apache License 2.0
30 stars 21 forks source link

Support lazy initialization for empty_xpu #1115

Open guangyey opened 8 hours ago

guangyey commented 8 hours ago

Motivation

Fix https://github.com/pytorch/pytorch/issues/140877 Some PyTorch C++ users could call empty op directly. In this situation, lazy initialization would not have been triggered. So we have to add lazyInitDevice here, which also aligns with CUDA convention.