Forward pass for training. Args: x: TODO.
(self, x: torch.Tensor)
| 462 | self.merged = True |
| 463 | |
| 464 | def forward(self, x: torch.Tensor): |
| 465 | """Forward pass for training. |
| 466 | |
| 467 | Args: |
| 468 | x: TODO. |
| 469 | """ |
| 470 | if self.r > 0 and not self.merged: |
| 471 | return F.conv2d( |
| 472 | x, |
| 473 | self.weight + (self.lora_B @ self.lora_A).view(self.weight.shape) * self.scaling, |
| 474 | self.bias, |
| 475 | self.stride, |
| 476 | self.padding, |
| 477 | self.dilation, |
| 478 | self.groups, |
| 479 | ) |
| 480 | return nn.Conv2d.forward(self, x) |