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

Method forward

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

padMethod · 0.80

Tested by

no test coverage detected