Skip to content

Commit

Permalink
Torch functional tensors needs sync'ing before transferring to CPU.
Browse files Browse the repository at this point in the history
This patch fixes #8482.
  • Loading branch information
mcuiaws committed Dec 11, 2024
1 parent 7dd2697 commit 7a162ed
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions torch_xla/core/xla_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,9 @@ def convert_fn(tensors):
tensors, devices=[], wait=True, sync_xla_data=True)
if not convert:
return tensors
for t in tensors:
if torch._is_functional_tensor(t):
torch._functionalize_sync(t)
return torch_xla._XLAC._xla_get_cpu_tensors(tensors)

def select_fn(v):
Expand Down

0 comments on commit 7a162ed

Please sign in to comment.