r""" Args: x `(*, in_features)`: input tensor s `(*, style_features)`: style tensor or those can be broadcast Returns: y `(*, out_features)`:
(self, x: torch.Tensor, s: torch.Tensor)
| 282 | self.input_bias = None |
| 283 | |
| 284 | def forward(self, x: torch.Tensor, s: torch.Tensor): |
| 285 | r""" |
| 286 | Args: |
| 287 | x `(*, in_features)`: |
| 288 | input tensor |
| 289 | s `(*, style_features)`: |
| 290 | style tensor or those can be broadcast |
| 291 | Returns: |
| 292 | y `(*, out_features)`: |
| 293 | |
| 294 | """ |
| 295 | dx, _ = self.subspace(input=s, mode="A", input_left=None) # (*, cin) or (batch, cin) |
| 296 | |
| 297 | # add input bias |
| 298 | ndim = x.ndim |
| 299 | if self.input_bias is not None: |
| 300 | dx = dx + self.input_bias.view(*([1] * (ndim - 1) + [self.in_features])) |
| 301 | if self.fixed_input_bias is not None: |
| 302 | dx = dx + self.fixed_input_bias |
| 303 | |
| 304 | y = self.linear(x, dx) |
| 305 | return y |
| 306 | |
| 307 | def subspace_fun(self, xl=None, xr=None, mode="A"): |
| 308 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected