Unverified Commit 1dd2d66e authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Avoid division by zero in make_grid

Fixes https://github.com/pytorch/vision/issues/397
parent dac9efae
...@@ -52,7 +52,7 @@ def make_grid(tensor, nrow=8, padding=2, ...@@ -52,7 +52,7 @@ def make_grid(tensor, nrow=8, padding=2,
def norm_ip(img, min, max): def norm_ip(img, min, max):
img.clamp_(min=min, max=max) img.clamp_(min=min, max=max)
img.add_(-min).div_(max - min) img.add_(-min).div_(max - min + 1e-5)
def norm_range(t, range): def norm_range(t, range):
if range is not None: if range is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment