Implement Defense GAN defender#7
Conversation
vpozdnyakov
left a comment
There was a problem hiding this comment.
Нужно доработать, оставил комментарии
| self.noise_size = noise_size | ||
| super().__init__() | ||
| self.model = nn.Sequential( | ||
| nn.Linear(100, 256), |
There was a problem hiding this comment.
наверное тут должно быть nn.Linear(noise_size, 256)
There was a problem hiding this comment.
256 лучше не хардкодить, а дать пользователю возможность указать
| noise_size: int = 256): | ||
| self.num_sensors = num_sensors | ||
| self.window_size = window_size | ||
| self.noise_size = noise_size |
There was a problem hiding this comment.
зачем хранить размер шума? он вроде нигде не используется
| nn.LeakyReLU(True), | ||
| nn.Linear(256, 256), | ||
| nn.LeakyReLU(True), | ||
| nn.Linear(256, 256), |
There was a problem hiding this comment.
количество слоев лучше тоже указывать в параметре
| return self.model(x).view(-1, self.window_size, self.num_sensors) | ||
|
|
||
|
|
||
| class Discriminator(nn.Module): |
There was a problem hiding this comment.
аналогичные комментарии как и для генератора. добавить число слоев и размерность в виде параметров
| return self.model(x) | ||
|
|
||
|
|
||
| class DefenseGanDefender(BaseDefender): |
There was a problem hiding this comment.
не очень удачное название, два раза повторяется слово defense. пусть будет просто GANDefender
| return self.model.predict(np.stack(approximations)) | ||
|
|
||
|
|
||
| # GRU version |
There was a problem hiding this comment.
не надо добавлять комментарии между классами
|
|
||
| # GRU version | ||
|
|
||
| class SelectItem(nn.Module): |
There was a problem hiding this comment.
что это за класс? для чего он нужен?
| self.noise_size = noise_size | ||
| super().__init__() | ||
| self.model = nn.Sequential( | ||
| nn.GRU(self.noise_size, 128, num_layers=1, batch_first=True), |
There was a problem hiding this comment.
128 не надо харкодить, вынести в параметры
| return self.model(x) | ||
|
|
||
|
|
||
| class GRUDiscriminator(nn.Module): |
There was a problem hiding this comment.
128 не надо харкодить, вынести в параметры
| return self.model(x) | ||
|
|
||
|
|
||
| class GRUDefenseGanDefender(BaseDefender): |
There was a problem hiding this comment.
в чем отличие этого класса от DefenseGANDefender? если только в том что разные архитектуры генератора и дискриминатора, то лучше это внутри одного класса сделать.
Cr.: Иван Галкин, Иван Конюшенко, Александр Срибняк, Ренат Харисов