Esempio n. 1
0
 def nin(self, x, num_units, **kwargs):
     module = getattr(self, str(self.counter), None)
     if module is None:
         module = model.WN_Conv2d(x.size(1), num_units, 1, train_scale=True, **kwargs).cuda()
         self.add_module(str(self.counter), module)
     self.counter += 1
     xs = x.size()
     return module(x)
Esempio n. 2
0
 def down_right_shifted_conv2d(self, x, num_filters, filter_size=(2, 2), stride=(1, 1), **kwargs):
     x = F.pad(x, (filter_size[1] - 1, 0, filter_size[0] - 1, 0))
     module = getattr(self, str(self.counter), None)
     if module is None:
         module = model.WN_Conv2d(x.size(1), num_filters, filter_size, stride, train_scale=True, **kwargs).cuda()
         self.add_module(str(self.counter), module)
     self.counter += 1
     return module(x)