Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier committed Jul 31, 2023
1 parent 1899e5f commit bc6728a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions torchvision/datapoints/_dataset_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ def wrap_dataset_for_transforms_v2(dataset, target_keys=None):
f"but got {target_keys}"
)

# Imagine we have isinstance(dataset, datasets.ImageNet). This will create a type with the name "WrappedImageNet" at
# runtime that doubly inherits from VisionDatasetDatapointWrapper (see below) as well as the original ImageNet
# class. This allows the user to do regular isinstance(wrapped_dataset, datasets.ImageNet) checks, while we can
# still inject everything that we need.
# Imagine we have isinstance(dataset, datasets.ImageNet). This will create a new class with the name
# "WrappedImageNet" at runtime that doubly inherits from VisionDatasetDatapointWrapper (see below) as well as the
# original ImageNet class. This allows the user to do regular isinstance(wrapped_dataset, datasets.ImageNet) checks,
# while we can still inject everything that we need.
wrapped_dataset_cls = type(f"Wrapped{type(dataset).__name__}", (VisionDatasetDatapointWrapper, type(dataset)), {})
# Since VisionDatasetDatapointWrapper comes before ImageNet in the MRO, calling the class hits
# VisionDatasetDatapointWrapper.__init__ first. Since we are never doing super().__init__(...), the constructor of
Expand Down

0 comments on commit bc6728a

Please sign in to comment.