(self, in_features, out_features, bias=True, device=None, dtype=None)
| 58 | |
| 59 | class Layer(nn.Linear): |
| 60 | def __init__(self, in_features, out_features, bias=True, device=None, dtype=None): |
| 61 | super().__init__(in_features, out_features, bias, device, dtype) |
| 62 | self.relu = torch.nn.ReLU() |
| 63 | self.opt = Adam(self.parameters(), lr=args.lr) |
| 64 | self.threshold = args.threshold |
| 65 | self.num_epochs = args.epochs |
| 66 | |
| 67 | def forward(self, x): |
| 68 | x_direction = x / (x.norm(2, 1, keepdim=True) + 1e-4) |