Unverified Commit ef2e4187 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

don't close file handles in protoype dataset tests (#4963)



* don't close file handles in protoype dataset tests

* remove file closing from decoder
Co-authored-by: default avatarFrancisco Massa <fvsmassa@gmail.com>
parent 9d15f2e6
......@@ -10,10 +10,7 @@ from torchvision.prototype.utils._internal import sequence_to_str
def to_bytes(file):
try:
return file.read()
finally:
file.close()
def dataset_parametrization(*names, decoder=to_bytes):
......
......@@ -13,7 +13,4 @@ def raw(buffer: io.IOBase) -> torch.Tensor:
def pil(buffer: io.IOBase) -> features.Image:
try:
return features.Image(pil_to_tensor(PIL.Image.open(buffer)))
finally:
buffer.close()
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