MCPcopy Create free account
hub / github.com/CompVis/diff2flow / forward

Method forward

diff2flow/lora.py:155–171  ·  view source on GitHub ↗

Args: x (torch.Tensor): In shape of (B, C, H, W)

(self, x)

Source from the content-addressed store, hash-verified

153 self.gamma = nn.Conv2d(c_dim, rank, kernel_size=1, bias=False)
154
155 def forward(self, x):
156 """
157 Args:
158 x (torch.Tensor): In shape of (B, C, H, W)
159 """
160 w_out = self.W(x)
161 a_out = self.A(x)
162
163 # inject conditioning into LoRA
164 c = self.data_provider.get_batch(a_out)
165 element_shift = self.beta(c)
166 element_scale = self.gamma(c) + 1
167 a_cond = a_out * element_scale + element_shift
168
169 b_out = self.B(a_cond)
170
171 return w_out + b_out * self.lora_scale

Callers

nothing calls this directly

Calls 1

get_batchMethod · 0.80

Tested by

no test coverage detected