Skip to content

Commit

Permalink
clamp input (comfyanonymous#5928)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haoming02 authored Dec 7, 2024
1 parent 93477f8 commit fbf68c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion comfy/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def fp8_linear(self, input):

if scale_input is None:
scale_input = torch.ones((), device=input.device, dtype=torch.float32)
inn = input.reshape(-1, input.shape[2]).to(dtype)
inn = torch.clamp(input, min=-448, max=448).reshape(-1, input.shape[2]).to(dtype)
else:
scale_input = scale_input.to(input.device)
inn = (input * (1.0 / scale_input).to(input.dtype)).reshape(-1, input.shape[2]).to(dtype)
Expand Down

0 comments on commit fbf68c4

Please sign in to comment.