def __init__(self): super(ConditionalDiscriminatorBlock, self).__init__() self.c_net = nn.Sequential( # (N, 80, Tmel) ll.CustomConv1d(80, 256, kernel_size=1, stride=1, padding='same', lrelu=True), # (N, 256, Tmel) ) self.net = nn.ModuleList([ # (N, n_mags, Tmel*4) ll.CustomConv1d(args.n_mags, 64, kernel_size=5, stride=1, padding='same', lrelu=True), mm.ResidualBlock1d(64, 128), mm.ResidualBlock1d(128, 256), nn.AvgPool1d(3, 2, padding=1), # (N, 256, Tmel*2) mm.ResidualBlock1d(256, 256), nn.AvgPool1d(3, 2, padding=1), # (N, 256, Tmel) mm.ResidualBlock1d(256, 256) ]) self.postnet = nn.ModuleList([ mm.ResidualBlock1d(256, 512), nn.AvgPool1d(3, 2, padding=1), # (N, 256, Tmel//2) mm.ResidualBlock1d(512, 512), nn.AvgPool1d(3, 2, padding=1), # (N, 256, Tmel//4) mm.ResidualBlock1d(512, 256), mm.ResidualBlock1d(256, 1) ])
def __init__(self): super(ConditionalDiscriminatorBlock, self).__init__() self.c_net = nn.Sequential( # (N, 80, Tmel) ll.CustomConv1d(80, 256, kernel_size=1, stride=1, padding='same', lrelu=True), # (N, 256, Tmel) ) self.net = nn.ModuleList([ # (N, n_mags, Tmel*4) ll.CustomConv1d(args.n_mags, 64, kernel_size=3, stride=1, padding='same', lrelu=True), # (N, 16, Tmel*4) ll.CustomConv1d(64, 128, kernel_size=5, stride=2, padding='same', lrelu=True), # (N, 64, Tmel*2) ll.CustomConv1d(128, 256, kernel_size=5, stride=2, padding='same', lrelu=True), # (N, 256, Tmel) ]) self.postnet = nn.ModuleList([ ll.CustomConv1d(256, 256, kernel_size=3, stride=1, padding='same', lrelu=True), ll.CustomConv1d(256, 128, kernel_size=3, stride=1, padding='same', lrelu=True), ll.CustomConv1d(128, 1, kernel_size=3, stride=1, padding='same', lrelu=False), ])
def __init__(self, in_planes, planes, ksize=3): super(ResidualBlock1d, self).__init__() self.conv1 = ll.CustomConv1d(in_planes, planes, ksize, lrelu=True) self.conv2 = ll.CustomConv1d(planes, planes, ksize, lrelu=True) self.proj = nn.Conv1d(in_planes, planes, 1) if in_planes != planes else None
def __init__(self, d_hidden): super(DotProductAttention, self).__init__() self.d_k = d_hidden self.linear_q = ll.CustomConv1d(d_hidden, d_hidden, 1) self.linear_k = ll.CustomConv1d(d_hidden, d_hidden, 1) self.linear_v = ll.CustomConv1d(d_hidden, d_hidden, 1)