Skip to content

Commit 9c3308a

Browse files
committed
More docs
1 parent e2519c8 commit 9c3308a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

torchvision/transforms/v2/_transform.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,23 @@ def check_inputs(self, flat_inputs: List[Any]) -> None:
3939
# keep in order to guarantee 100% BC with v1. (It's defined in
4040
# __init_subclass__ below).
4141
def make_params(self, flat_inputs: List[Any]) -> Dict[str, Any]:
42+
"""Method to override for custom transforms.
43+
44+
See :ref:`sphx_glr_auto_examples_transforms_plot_custom_transforms.py`"""
4245
return dict()
4346

4447
def _call_kernel(self, functional: Callable, inpt: Any, *args: Any, **kwargs: Any) -> Any:
4548
kernel = _get_kernel(functional, type(inpt), allow_passthrough=True)
4649
return kernel(inpt, *args, **kwargs)
4750

4851
def transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
52+
"""Method to override for custom transforms.
53+
54+
See :ref:`sphx_glr_auto_examples_transforms_plot_custom_transforms.py`"""
4955
raise NotImplementedError
5056

5157
def forward(self, *inputs: Any) -> Any:
58+
"""Do not override this! Use ``transform()`` instead."""
5259
flat_inputs, spec = tree_flatten(inputs if len(inputs) > 1 else inputs[0])
5360

5461
self.check_inputs(flat_inputs)

0 commit comments

Comments
 (0)