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