MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / forward

Method forward

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

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

(self, x: torch.FloatTensor)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

is_torch_versionFunction · 0.85
layersMethod · 0.80

Tested by

no test coverage detected