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()
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))
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)