-
Notifications
You must be signed in to change notification settings - Fork 443
Temporal transform: rearrange temporal and channel dimensions #2477
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
base: main
Are you sure you want to change the base?
Conversation
Would be better to have a single PR for each transform instead of multiple in 1 PR. |
Not sure if the class names and functions are good. Tagging @adamjstewart for review. |
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.
My vote would be for a single class that simply wraps around einops.rearrange
like so:
class Rearrange(GeometricAugmentationBase2D):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(p=1)
self.flags = {'args': args, 'kwargs': kwargs}
def apply_transform(
self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any], transform: Optional[Tensor] = None
) -> Tensor:
return rearrange(input, *flags['args'], **flags['kwargs'])
Note that GeometricAugmentationBase2D
has additional functions that need to be overridden, see https://kornia.readthedocs.io/en/latest/augmentation.base.html#custom-augmentation-classes for details.
This PR is to add a temporal transform: rearrange temporal and channel dimensions, as mentioned in #2382.