Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions transformer_engine/pytorch/tensor/float8_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ def _set_data(self, tensor: torch.Tensor) -> None:

# Tensor device
new_device = tensor.device if tensor.is_cuda else self.device
if not devices_match(new_device, tensor.device):
tensor = tensor.to(device=new_device)

# Just copy FP8 data if other tensor is Float8Tensor
if isinstance(tensor, Float8Tensor):
Expand Down
2 changes: 2 additions & 0 deletions transformer_engine/pytorch/tensor/mxfp8_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ def _set_data(self, tensor: torch.Tensor) -> None:

# Tensor device
new_device = tensor.device if tensor.is_cuda else self.device
if not devices_match(new_device, tensor.device):
tensor = tensor.to(device=new_device)

# Just copy FP8 data if other tensor is MXFP8Tensor
if isinstance(tensor, MXFP8Tensor):
Expand Down