Skip to content

Commit 7c51d14

Browse files
AhmedZeroalinpahontu2912
authored andcommitted
Update the condition
1 parent 78c0cee commit 7c51d14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/TorchVision/Functional.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ public static Tensor normalize(Tensor input, double[] means, double[] stdevs, bo
562562

563563
var mean = as_tensor(means, dtype: input.dtype, device: input.device);
564564
var stdev = as_tensor(stdevs, dtype: input.dtype, device: input.device);
565-
if (stdev.eq(0).any().ToBoolean())
565+
if ((stdev == 0).any().item<bool>())
566566
throw new ArgumentException($"std evaluated to zero after conversion to {input.dtype}, leading to division by zero.");
567567
if (mean.ndim == 1)
568568
mean = mean.view(-1, 1, 1);

0 commit comments

Comments
 (0)