(self, in_channels, out_channels, bias=True)
| 7 | |
| 8 | class LinearDummy(torch.nn.Module): |
| 9 | def __init__(self, in_channels, out_channels, bias=True): |
| 10 | super().__init__() |
| 11 | self.out_channels = out_channels |
| 12 | self.weight = torch.nn.Parameter(torch.randn(out_channels, in_channels)) |
| 13 | self.bias=None |
| 14 | if bias: |
| 15 | self.bias = torch.nn.Parameter(torch.zeros(out_channels)) |
| 16 | |
| 17 | def forward(self, x, gain=1): |
| 18 | return F.linear(x, self.weight, self.bias) |