Exemplo n.º 1
0
 def __init__(self, size_in, length, size, stride=1, padding=None):
     super(Convolution1D, self).__init__()
     util.autoassign(locals())
     padding = padding if padding is not None else self.length
     self.Conv = nn.Conv1d(self.size_in, self.size, self.length, stride=self.stride, padding=padding, bias=False)
     # use Glorot uniform initialization
     self.Conv.weight.data = init.glorot_uniform((self.size, self.size_in, self.length, 1)).squeeze()
Exemplo n.º 2
0
 def __init__(self, size_in, length, size, stride=1):
     super(Convolution1D, self).__init__()
     util.autoassign(locals())
     self.Conv = nn.Conv1d(self.size_in,
                           self.size,
                           self.length,
                           stride=self.stride,
                           padding=self.length)
     # use Glorot uniform initialization
     self.Conv.weight.data = init.glorot_uniform(
         (self.size, self.size_in, self.length))
Exemplo n.º 3
0
 def __init__(self,
              size_in,
              length,
              size,
              stride=1,
              padding=None,
              maxpool=False):
     super(Convolution1D, self).__init__()
     util.autoassign(locals())
     padding = padding if padding is not None else self.length
     self.Conv = nn.Conv1d(self.size_in,
                           self.size,
                           self.length,
                           stride=self.stride,
                           padding=padding,
                           bias=False)
     # use Glorot uniform initialization
     self.Conv.weight.data = init.glorot_uniform(
         (self.size, self.size_in, self.length, 1)).squeeze()
     #FIXME what is the correct padding???
     if self.maxpool:
         self.Maxpool = nn.MaxPool1d(2, 2, ceil_mode=True)