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

Method forward

diffusers/src/diffusers/models/lora.py:369–383  ·  view source on GitHub ↗
(self, hidden_states: torch.Tensor, scale: float = 1.0)

Source from the content-addressed store, hash-verified

367 self.w_down = None
368
369 def forward(self, hidden_states: torch.Tensor, scale: float = 1.0) -> torch.Tensor:
370 if self.padding_mode != "zeros":
371 hidden_states = F.pad(hidden_states, self._reversed_padding_repeated_twice, mode=self.padding_mode)
372 padding = (0, 0)
373 else:
374 padding = self.padding
375
376 original_outputs = F.conv2d(
377 hidden_states, self.weight, self.bias, self.stride, padding, self.dilation, self.groups
378 )
379
380 if self.lora_layer is None:
381 return original_outputs
382 else:
383 return original_outputs + (scale * self.lora_layer(hidden_states))
384
385
386class LoRACompatibleLinear(nn.Linear):

Callers

nothing calls this directly

Calls 1

padMethod · 0.80

Tested by

no test coverage detected