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

Method forward

diffusers/src/diffusers/models/downsampling.py:132–149  ·  view source on GitHub ↗
(self, hidden_states: torch.Tensor, *args, **kwargs)

Source from the content-addressed store, hash-verified

130 self.conv = conv
131
132 def forward(self, hidden_states: torch.Tensor, *args, **kwargs) -> torch.Tensor:
133 if len(args) > 0 or kwargs.get("scale", None) is not None:
134 deprecation_message = "The `scale` argument is deprecated and will be ignored. Please remove it, as passing it will raise an error in the future. `scale` should directly be passed while calling the underlying pipeline component i.e., via `cross_attention_kwargs`."
135 deprecate("scale", "1.0.0", deprecation_message)
136 assert hidden_states.shape[1] == self.channels
137
138 if self.norm is not None:
139 hidden_states = self.norm(hidden_states.permute(0, 2, 3, 1)).permute(0, 3, 1, 2)
140
141 if self.use_conv and self.padding == 0:
142 pad = (0, 1, 0, 1)
143 hidden_states = F.pad(hidden_states, pad, mode="constant", value=0)
144
145 assert hidden_states.shape[1] == self.channels
146
147 hidden_states = self.conv(hidden_states)
148
149 return hidden_states
150
151
152class FirDownsample2D(nn.Module):

Callers

nothing calls this directly

Calls 2

deprecateFunction · 0.85
padMethod · 0.80

Tested by

no test coverage detected