Skip to content

Commit

Permalink
update the order of xpu condition checking (#3220)
Browse files Browse the repository at this point in the history
Co-authored-by: Ankith Gunapal <agunapal@ischool.Berkeley.edu>
  • Loading branch information
Kanya-Mo and agunapal authored Jul 2, 2024
1 parent e979f41 commit f80e906
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ts/torch_handler/base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ def initialize(self, context):
self.map_location + ":" + str(properties.get("gpu_id"))
)
elif (
torch.xpu.is_available()
os.environ.get("TS_IPEX_GPU_ENABLE", "false") == "true"
and properties.get("gpu_id") is not None
and os.environ.get("TS_IPEX_GPU_ENABLE", "false") == "true"
and torch.xpu.is_available()
):
self.map_location = "xpu"
self.device = torch.device(
Expand Down

0 comments on commit f80e906

Please sign in to comment.