Skip to content

Commit 127e8a7

Browse files
zshn25NicolasHug
andauthored
Making root parameter optional for Vision Dataset (#8124)
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com> Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com>
1 parent c7e2947 commit 127e8a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchvision/datasets/vision.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class VisionDataset(data.Dataset):
1212
It is necessary to override the ``__getitem__`` and ``__len__`` method.
1313
1414
Args:
15-
root (string): Root directory of dataset.
15+
root (string, optional): Root directory of dataset. Only used for `__repr__`.
1616
transforms (callable, optional): A function/transforms that takes in
1717
an image and a label and returns the transformed versions of both.
1818
transform (callable, optional): A function/transform that takes in an PIL image
@@ -29,7 +29,7 @@ class VisionDataset(data.Dataset):
2929

3030
def __init__(
3131
self,
32-
root: str,
32+
root: Optional[str] = None,
3333
transforms: Optional[Callable] = None,
3434
transform: Optional[Callable] = None,
3535
target_transform: Optional[Callable] = None,

0 commit comments

Comments
 (0)