-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow nn.ModuleList in RandomApply #7197
Conversation
class RandomApply(Compose): | ||
def __init__(self, transforms: Sequence[Callable], p: float = 0.5) -> None: | ||
super().__init__(transforms) | ||
class RandomApply(Transform): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We inherited from Compose
before, because both shared the same constructor as well as extra_repr
. With this patch, the constructor is different and thus I decided to just copy paste extra_repr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Philip, LGTM, a small unit test would be nice before merging if we have time
Reviewed By: vmoens Differential Revision: D44416259 fbshipit-source-id: cbd7c731f37f13b3bdb4d117225910fa019eac60
This is allowed in v1 for JIT scriptability:
vision/torchvision/transforms/transforms.py
Lines 495 to 502 in 1120aa9
cc @vfdev-5 @bjuncek