MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / forward

Method forward

diffusers/src/diffusers/models/autoencoders/vae.py:877–896  ·  view source on GitHub ↗

r"""The forward method of the `EncoderTiny` class.

(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

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
899class DecoderTiny(nn.Module):

Callers

nothing calls this directly

Calls 2

is_torch_versionFunction · 0.85
layersMethod · 0.80

Tested by

no test coverage detected