You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
MONAI array transforms are all derived from Transform base class by implementing __call__ method, and similar to torchvision transform can be chained using Compose. However, in torchvision transforms without losing any backward compatibility are inherited fromnn.Module (since v0.8.0). This has some obvious benefits:
They can be used torchscripted with torch.jit.script
They can be chained using nn.Sequential. This will allow the transforms be chained with the model as well and let them run on the same device that model is being run.
Describe the solution you'd like
Derive all transform from torch.nn.Module instead of Transform
Implement forward for all transforms instead of __call__
Is your feature request related to a problem? Please describe.
MONAI array transforms are all derived from
Transformbase class by implementing__call__method, and similar to torchvision transform can be chained usingCompose. However, in torchvision transforms without losing any backward compatibility are inherited fromnn.Module(since v0.8.0). This has some obvious benefits:torch.jit.scriptnn.Sequential. This will allow the transforms be chained with the model as well and let them run on the same device that model is being run.Describe the solution you'd like
torch.nn.Moduleinstead ofTransformforwardfor all transforms instead of__call__torch.Tensors(Default to using Pytorch APIs formonai.transforms(ETA TBD) #2231)