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

Method forward

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

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

(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

958 self.gradient_checkpointing = False
959
960 def forward(self, x: torch.Tensor) -> torch.Tensor:
961 r"""The forward method of the `DecoderTiny` class."""
962 # Clamp.
963 x = torch.tanh(x / 3) * 3
964
965 if self.training and self.gradient_checkpointing:
966
967 def create_custom_forward(module):
968 def custom_forward(*inputs):
969 return module(*inputs)
970
971 return custom_forward
972
973 if is_torch_version(">=", "1.11.0"):
974 x = torch.utils.checkpoint.checkpoint(create_custom_forward(self.layers), x, use_reentrant=False)
975 else:
976 x = torch.utils.checkpoint.checkpoint(create_custom_forward(self.layers), x)
977
978 else:
979 x = self.layers(x)
980
981 # scale image from [0, 1] to [-1, 1] to match diffusers convention
982 return x.mul(2).sub(1)

Callers

nothing calls this directly

Calls 2

is_torch_versionFunction · 0.85
layersMethod · 0.80

Tested by

no test coverage detected