@@ -158,22 +158,16 @@ def test_tensor_gray_to_pil_image(self):
158
158
img_data_byte = torch .ByteTensor (1 , 4 , 4 ).random_ (0 , 255 )
159
159
img_data_short = torch .ShortTensor (1 , 4 , 4 ).random_ ()
160
160
img_data_int = torch .IntTensor (1 , 4 , 4 ).random_ ()
161
- img_data_float = torch .FloatTensor (1 , 4 , 4 ).uniform_ ()
162
161
163
162
img_byte = trans (img_data_byte )
164
163
img_short = trans (img_data_short )
165
164
img_int = trans (img_data_int )
166
- img_float = trans (img_data_float )
167
165
assert img_byte .mode == 'L'
168
166
assert img_short .mode == 'I;16'
169
167
assert img_int .mode == 'I'
170
- #assert img_float.mode == 'F'
171
168
172
169
assert np .allclose (img_data_short .numpy (), to_tensor (img_short ).numpy ())
173
170
assert np .allclose (img_data_int .numpy (), to_tensor (img_int ).numpy ())
174
- # would cause breaking changes as ToTensor converts to range [0, 1]
175
- #assert np.allclose(img_data_byte.numpy(), to_tensor(img_byte).numpy())
176
- #assert np.allclose(img_data_float.numpy(), to_tensor(img_float).numpy())
177
171
178
172
def test_ndarray_to_pil_image (self ):
179
173
trans = transforms .ToPILImage ()
0 commit comments