r"""The forward method of the `EncoderTiny` class.
(self, x: torch.Tensor)
| 875 | self.gradient_checkpointing = False |
| 876 | |
| 877 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 878 | r"""The forward method of the `EncoderTiny` class.""" |
| 879 | if self.training and self.gradient_checkpointing: |
| 880 | |
| 881 | def create_custom_forward(module): |
| 882 | def custom_forward(*inputs): |
| 883 | return module(*inputs) |
| 884 | |
| 885 | return custom_forward |
| 886 | |
| 887 | if is_torch_version(">=", "1.11.0"): |
| 888 | x = torch.utils.checkpoint.checkpoint(create_custom_forward(self.layers), x, use_reentrant=False) |
| 889 | else: |
| 890 | x = torch.utils.checkpoint.checkpoint(create_custom_forward(self.layers), x) |
| 891 | |
| 892 | else: |
| 893 | # scale image from [-1, 1] to [0, 1] to match TAESD convention |
| 894 | x = self.layers(x.add(1).div(2)) |
| 895 | |
| 896 | return x |
| 897 | |
| 898 | |
| 899 | class DecoderTiny(nn.Module): |
nothing calls this directly
no test coverage detected