Skip to content
Merged
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
9 changes: 6 additions & 3 deletions transformer_engine/pytorch/float8_tensor.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -263,7 +263,7 @@ def forward(
@staticmethod
def backward(ctx,
grad: torch.Tensor,
) -> Tuple[[torch.Tensor, None], ...]:
) -> Tuple[Union[torch.Tensor, None], ...]:

if isinstance(grad, Float8Tensor):
dgrad = Float8Tensor.make_like(
Expand DownExpand Up@@ -853,5 +853,8 @@ def _set_data(self, tensor: torch.Tensor) -> None:
_transpose_invalid = property(**_make_fp8_attr_property_funcs("transpose_invalid"))
_scale_inv = property(**_make_fp8_attr_property_funcs("scale_inv"))

# Do not force the Float8Tensor type on the returned tensor
__torch_function__ = torch._C._disabled_torch_function_impl
@classmethod
def __torch_function__(cls, func, types, args=(), kwargs=None):
if kwargs is None:
kwargs = {}
return torch._C._disabled_torch_function_impl(func, types, args, kwargs)