Commit ca2baffb authored by ptrblck's avatar ptrblck Committed by mcarilli
Browse files

Remove unused tensor in fast_collate (#281)

* remove unused tens tensor in example/imagenet/main_amp.py

* remove unused tens tensor in deprecated examples and tests/L1
parent 03a25ba8
...@@ -80,7 +80,6 @@ def fast_collate(batch): ...@@ -80,7 +80,6 @@ def fast_collate(batch):
tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 ) tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 )
for i, img in enumerate(imgs): for i, img in enumerate(imgs):
nump_array = np.asarray(img, dtype=np.uint8) nump_array = np.asarray(img, dtype=np.uint8)
tens = torch.from_numpy(nump_array)
if(nump_array.ndim < 3): if(nump_array.ndim < 3):
nump_array = np.expand_dims(nump_array, axis=-1) nump_array = np.expand_dims(nump_array, axis=-1)
nump_array = np.rollaxis(nump_array, 2) nump_array = np.rollaxis(nump_array, 2)
......
...@@ -79,7 +79,6 @@ def fast_collate(batch): ...@@ -79,7 +79,6 @@ def fast_collate(batch):
tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 ) tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 )
for i, img in enumerate(imgs): for i, img in enumerate(imgs):
nump_array = np.asarray(img, dtype=np.uint8) nump_array = np.asarray(img, dtype=np.uint8)
tens = torch.from_numpy(nump_array)
if(nump_array.ndim < 3): if(nump_array.ndim < 3):
nump_array = np.expand_dims(nump_array, axis=-1) nump_array = np.expand_dims(nump_array, axis=-1)
nump_array = np.rollaxis(nump_array, 2) nump_array = np.rollaxis(nump_array, 2)
......
...@@ -83,7 +83,6 @@ def fast_collate(batch): ...@@ -83,7 +83,6 @@ def fast_collate(batch):
tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 ) tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 )
for i, img in enumerate(imgs): for i, img in enumerate(imgs):
nump_array = np.asarray(img, dtype=np.uint8) nump_array = np.asarray(img, dtype=np.uint8)
tens = torch.from_numpy(nump_array)
if(nump_array.ndim < 3): if(nump_array.ndim < 3):
nump_array = np.expand_dims(nump_array, axis=-1) nump_array = np.expand_dims(nump_array, axis=-1)
nump_array = np.rollaxis(nump_array, 2) nump_array = np.rollaxis(nump_array, 2)
......
...@@ -79,7 +79,6 @@ def fast_collate(batch): ...@@ -79,7 +79,6 @@ def fast_collate(batch):
tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 ) tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 )
for i, img in enumerate(imgs): for i, img in enumerate(imgs):
nump_array = np.asarray(img, dtype=np.uint8) nump_array = np.asarray(img, dtype=np.uint8)
tens = torch.from_numpy(nump_array)
if(nump_array.ndim < 3): if(nump_array.ndim < 3):
nump_array = np.expand_dims(nump_array, axis=-1) nump_array = np.expand_dims(nump_array, axis=-1)
nump_array = np.rollaxis(nump_array, 2) nump_array = np.rollaxis(nump_array, 2)
......
...@@ -82,7 +82,6 @@ def fast_collate(batch): ...@@ -82,7 +82,6 @@ def fast_collate(batch):
tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 ) tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 )
for i, img in enumerate(imgs): for i, img in enumerate(imgs):
nump_array = np.asarray(img, dtype=np.uint8) nump_array = np.asarray(img, dtype=np.uint8)
tens = torch.from_numpy(nump_array)
if(nump_array.ndim < 3): if(nump_array.ndim < 3):
nump_array = np.expand_dims(nump_array, axis=-1) nump_array = np.expand_dims(nump_array, axis=-1)
nump_array = np.rollaxis(nump_array, 2) nump_array = np.rollaxis(nump_array, 2)
......
...@@ -86,7 +86,6 @@ def fast_collate(batch): ...@@ -86,7 +86,6 @@ def fast_collate(batch):
tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 ) tensor = torch.zeros( (len(imgs), 3, h, w), dtype=torch.uint8 )
for i, img in enumerate(imgs): for i, img in enumerate(imgs):
nump_array = np.asarray(img, dtype=np.uint8) nump_array = np.asarray(img, dtype=np.uint8)
tens = torch.from_numpy(nump_array)
if(nump_array.ndim < 3): if(nump_array.ndim < 3):
nump_array = np.expand_dims(nump_array, axis=-1) nump_array = np.expand_dims(nump_array, axis=-1)
nump_array = np.rollaxis(nump_array, 2) nump_array = np.rollaxis(nump_array, 2)
......
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