Skip to content

Commit 22c548b

Browse files
authored
[POC] Base class for dataset tests (#3402)
* add base class for datasets tests * add better type hints * add documentation to subclasses * add utility functions to create files / folders of random images and videos * fix imports * remove class properties * fix smoke test * fix type hints * fix random size generation * add Caltech256 as example * add utility function to create grid of combinations * add CIFAR100? as example * lint * add missing import * improve documentation * create 1 frame videos by default * remove obsolete check * return path of files created with utility functions * [test] close PIL file handles before deletion * fix video folder creation * generalize file handle closing * fix lazy imports * add test for transforms * fix explanation comment * lint * force load opened PIL images * lint * copy default config to avoid inplace modification * enable additional arg forwarding
1 parent c1f85d3 commit 22c548b

File tree

3 files changed

+784
-1
lines changed

3 files changed

+784
-1
lines changed

test/common_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,11 @@ def int_dtypes():
393393

394394
def float_dtypes():
395395
return torch.testing.floating_types()
396+
397+
398+
@contextlib.contextmanager
399+
def disable_console_output():
400+
with contextlib.ExitStack() as stack, open(os.devnull, "w") as devnull:
401+
stack.enter_context(contextlib.redirect_stdout(devnull))
402+
stack.enter_context(contextlib.redirect_stderr(devnull))
403+
yield

0 commit comments

Comments
 (0)