Skip to content

Commit d53fbc5

Browse files
bwbwzzzbwzhou
andauthored
fix(special_i0): avoid unnecessary x.to() temporary allocation (#83)
Co-authored-by: bwzhou <bwzhou@users.noreply.github.com>
1 parent 5d29595 commit d53fbc5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/flag_gems/ops/special_i0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def special_i0(x: torch.Tensor):
120120
if not x.is_cuda:
121121
raise ValueError("special_i0: input tensor must be on CUDA device")
122122
out_dtype = x.dtype if x.is_floating_point() else torch.get_default_dtype()
123-
out = torch.empty_like(x.to(dtype=out_dtype), dtype=out_dtype, device=x.device)
123+
out = torch.empty_like(x, dtype=out_dtype)
124124
_launch_special_i0(out, x)
125125
return out
126126

0 commit comments

Comments
 (0)