Method
__init__
(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1, activation=None)
Source from the content-addressed store, hash-verified
| 108 | |
| 109 | class EqualLinear(nn.Module): |
| 110 | def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1, activation=None): |
| 111 | super().__init__() |
| 112 | |
| 113 | self.weight = nn.Parameter(torch.randn(out_dim, in_dim).div_(lr_mul)) |
| 114 | |
| 115 | if bias: |
| 116 | self.bias = nn.Parameter(torch.zeros(out_dim).fill_(bias_init)) |
| 117 | else: |
| 118 | self.bias = None |
| 119 | |
| 120 | self.activation = activation |
| 121 | |
| 122 | self.scale = (1 / math.sqrt(in_dim)) * lr_mul |
| 123 | self.lr_mul = lr_mul |
| 124 | |
| 125 | def forward(self, input): |
| 126 | |
Callers
nothing calls this directly
Tested by
no test coverage detected