Exemplo n.º 1
0
    def __init__(self, vocabSize, embSize, dSize):
        super(TextEnc, self).__init__()

        self.EmbLayer = module.Embed(
            vocabSize, embSize)  # (1 , T) -> (V, T), (e, V) * (V, T) -> (e, T)
        self.seq = nn.ModuleList()
        self.Conv1st = module.Cv(inChannel=embSize,
                                 outChannel=dSize * 2,
                                 kernelSize=1,
                                 padding="SAME",
                                 dilation=1,
                                 activationF="ReLU")
        self.seq.append(self.Conv1st)
        self.seq.append(nn.Dropout(param.dr))

        self.Conv2nd = module.Cv(inChannel=dSize * 2,
                                 outChannel=dSize * 2,
                                 kernelSize=1,
                                 padding="SAME",
                                 dilation=1,
                                 activationF=None)
        self.seq.append(self.Conv2nd)
        self.seq.append(nn.Dropout(param.dr))

        # HcTwice
        for _ in range(2):
            for d in range(4):
                self.seq.append(
                    module.Hc(inChannel=dSize * 2,
                              outChannel=dSize * 2,
                              kernelSize=3,
                              padding="SAME",
                              dilation=3**d))

                self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            self.seq.append(
                module.Hc(inChannel=dSize * 2,
                          outChannel=dSize * 2,
                          kernelSize=3,
                          padding="SAME",
                          dilation=1))

            self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            self.seq.append(
                module.Hc(inChannel=dSize * 2,
                          outChannel=dSize * 2,
                          kernelSize=1,
                          padding="SAME",
                          dilation=1))
Exemplo n.º 2
0
    def __init__(self, fbinSize, dSize):
        super(AudioEnc, self).__init__()
        self.seq = nn.ModuleList()
        self.Conv1st = module.Cv(inChannel=fbinSize,
                                 outChannel=dSize,
                                 kernelSize=1,
                                 padding="causal",
                                 dilation=1,
                                 activationF="ReLU")
        self.seq.append(self.Conv1st)

        self.seq.append(nn.Dropout(param.dr))

        self.Conv2nd = module.Cv(inChannel=dSize,
                                 outChannel=dSize,
                                 kernelSize=1,
                                 padding="causal",
                                 dilation=1,
                                 activationF="ReLU")
        self.seq.append(self.Conv2nd)

        self.seq.append(nn.Dropout(param.dr))

        self.Conv3rd = module.Cv(inChannel=dSize,
                                 outChannel=dSize,
                                 kernelSize=1,
                                 padding="causal",
                                 dilation=1,
                                 activationF=None)
        self.seq.append(self.Conv3rd)

        self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            for d in range(4):
                self.seq.append(
                    module.Hc(inChannel=dSize,
                              outChannel=dSize,
                              kernelSize=3,
                              padding="causal",
                              dilation=3**d))

                self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            self.seq.append(
                module.Hc(inChannel=dSize,
                          outChannel=dSize,
                          kernelSize=3,
                          padding="causal",
                          dilation=3))
Exemplo n.º 3
0
    def __init__(self, upsamfbinSize, fbinSize, c, dSize):
        super(SSRN, self).__init__()
        self.seq = nn.ModuleList()
        self.Conv1st = module.Cv(inChannel=fbinSize,
                                 outChannel=c,
                                 kernelSize=1,
                                 padding="SAME",
                                 dilation=1,
                                 activationF=None)
        self.seq.append(self.Conv1st)

        self.seq.append(nn.Dropout(param.dr))

        for d in range(2):
            self.seq.append(
                module.Hc(inChannel=c,
                          outChannel=c,
                          kernelSize=3,
                          padding="SAME",
                          dilation=3**d))

            self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            self.seq.append(
                module.Dc(inChannel=c,
                          outChannel=c,
                          kernelSize=2,
                          padding="SAME",
                          dilation=1,
                          activationF=None))

            self.seq.append(nn.Dropout(param.dr))

            for _ in range(2):
                self.seq.append(
                    module.Hc(inChannel=c,
                              outChannel=c,
                              kernelSize=3,
                              padding="SAME",
                              dilation=1))

                self.seq.append(nn.Dropout(param.dr))

        self.seq.append(
            module.Cv(inChannel=c,
                      outChannel=2 * c,
                      kernelSize=1,
                      padding="SAME",
                      dilation=1,
                      activationF=None))

        self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            self.seq.append(
                module.Hc(inChannel=2 * c,
                          outChannel=2 * c,
                          kernelSize=3,
                          padding="SAME",
                          dilation=1))

            self.seq.append(nn.Dropout(param.dr))

        self.seq.append(
            module.Cv(inChannel=2 * c,
                      outChannel=upsamfbinSize,
                      kernelSize=1,
                      padding="SAME",
                      dilation=1,
                      activationF=None))
        self.seq.append(nn.Dropout(param.dr))

        for _ in range(2):
            self.seq.append(
                module.Cv(inChannel=upsamfbinSize,
                          outChannel=upsamfbinSize,
                          kernelSize=1,
                          padding="SAME",
                          dilation=1,
                          activationF="ReLU"))

            self.seq.append(nn.Dropout(param.dr))

        self.ConvLast = module.Cv(inChannel=upsamfbinSize,
                                  outChannel=upsamfbinSize,
                                  kernelSize=1,
                                  padding="SAME",
                                  dilation=1,
                                  activationF="sigmoid")
        self.seq.append(self.ConvLast)
Exemplo n.º 4
0
 def __init__(self, upsamfbinSize, fbinSize, c, dSize):
     super(SSRN, self).__init__()
     self.Conv1st = module.Cv(inChannel=fbinSize,
                              outChannel=c,
                              kernelSize=1,
                              padding="SAME",
                              dilation=1,
                              activationF=None)
     self.Hc1 = nn.Sequential(
         module.Hc(inChannel=c,
                   outChannel=c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=1),
         module.Hc(inChannel=c,
                   outChannel=c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=3))
     self.DcHcTwice1 = nn.Sequential(
         module.Dc(inChannel=c,
                   outChannel=c,
                   kernelSize=2,
                   padding="SAME",
                   dilation=1,
                   activationF=None),
         module.Hc(inChannel=c,
                   outChannel=c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=1),
         module.Hc(inChannel=c,
                   outChannel=c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=3))
     self.DcHcTwice2 = nn.Sequential(
         module.Dc(inChannel=c,
                   outChannel=c,
                   kernelSize=2,
                   padding="SAME",
                   dilation=1,
                   activationF=None),
         module.Hc(inChannel=c,
                   outChannel=c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=1),
         module.Hc(inChannel=c,
                   outChannel=c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=3))
     self.Conv2nd = module.Cv(inChannel=c,
                              outChannel=2 * c,
                              kernelSize=1,
                              padding="SAME",
                              dilation=1,
                              activationF=None)
     self.HcTwice = nn.Sequential(
         module.Hc(inChannel=2 * c,
                   outChannel=2 * c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=1),
         module.Hc(inChannel=2 * c,
                   outChannel=2 * c,
                   kernelSize=3,
                   padding="SAME",
                   dilation=1))
     self.Conv3rd = module.Cv(inChannel=2 * c,
                              outChannel=upsamfbinSize,
                              kernelSize=1,
                              padding="SAME",
                              dilation=1,
                              activationF=None)
     self.ConvTwice = nn.Sequential(
         module.Cv(inChannel=upsamfbinSize,
                   outChannel=upsamfbinSize,
                   kernelSize=1,
                   padding="SAME",
                   dilation=1,
                   activationF="ReLU"),
         module.Cv(inChannel=upsamfbinSize,
                   outChannel=upsamfbinSize,
                   kernelSize=1,
                   padding="SAME",
                   dilation=1,
                   activationF="ReLU"))
     self.ConvLast = module.Cv(inChannel=upsamfbinSize,
                               outChannel=upsamfbinSize,
                               kernelSize=1,
                               padding="SAME",
                               dilation=1,
                               activationF="sigmoid")
Exemplo n.º 5
0
 def __init__(self, fbinSize, dSize):
     super(AudioDec, self).__init__()
     self.Conv1st = module.Cv(inChannel=dSize * 2,
                              outChannel=dSize,
                              kernelSize=1,
                              padding="causal",
                              dilation=1,
                              activationF=None)
     self.Hc1 = nn.Sequential(
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=1),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=3),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=9),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=27))
     self.Hc2 = nn.Sequential(
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=1),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=1))
     self.ConvThrice = nn.Sequential(
         module.Cv(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=1,
                   padding="causal",
                   dilation=1,
                   activationF="ReLU"),
         module.Cv(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=1,
                   padding="causal",
                   dilation=1,
                   activationF="ReLU"),
         module.Cv(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=1,
                   padding="causal",
                   dilation=1,
                   activationF="ReLU"))
     self.ConvLast = module.Cv(inChannel=dSize,
                               outChannel=fbinSize,
                               kernelSize=1,
                               padding="causal",
                               dilation=1,
                               activationF="sigmoid")
Exemplo n.º 6
0
    def __init__(self, vocabSize, embSize, dSize):
        super(TextEnc, self).__init__()
        self.EmbLayer = module.Embed(vocabSize, embSize)

        self.Conv1st = module.Cv(inChannel=embSize,
                                 outChannel=dSize * 2,
                                 kernelSize=1,
                                 padding="SAME",
                                 dilation=1,
                                 activationF="ReLU")

        self.Conv2nd = module.Cv(inChannel=dSize * 2,
                                 outChannel=dSize * 2,
                                 kernelSize=1,
                                 padding="SAME",
                                 dilation=1,
                                 activationF=None)

        self.HcTwice1 = nn.Sequential(
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=1),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=3),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=9),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=27))
        self.HcTwice2 = nn.Sequential(
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=1),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=3),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=9),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=27))
        self.Hc3 = nn.Sequential(
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=1),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=3,
                      padding="SAME",
                      dilation=1))
        self.Hc4 = nn.Sequential(
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=1,
                      padding="SAME",
                      dilation=1),
            module.Hc(inChannel=dSize * 2,
                      outChannel=dSize * 2,
                      kernelSize=1,
                      padding="SAME",
                      dilation=1))
Exemplo n.º 7
0
 def __init__(self, fbinSize, dSize):
     super(AudioEnc, self).__init__()
     self.Conv1st = module.Cv(inChannel=fbinSize,
                              outChannel=dSize,
                              kernelSize=1,
                              padding="causal",
                              dilation=1,
                              activationF="ReLU")
     self.Conv2nd = module.Cv(inChannel=dSize,
                              outChannel=dSize,
                              kernelSize=1,
                              padding="causal",
                              dilation=1,
                              activationF="ReLU")
     self.Conv3rd = module.Cv(inChannel=dSize,
                              outChannel=dSize,
                              kernelSize=1,
                              padding="causal",
                              dilation=1,
                              activationF=None)
     self.HcTwice1 = nn.Sequential(
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=1),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=3),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=9),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=27))
     self.HcTwice2 = nn.Sequential(
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=1),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=3),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=9),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=27))
     self.Hc3 = nn.Sequential(
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=3),
         module.Hc(inChannel=dSize,
                   outChannel=dSize,
                   kernelSize=3,
                   padding="causal",
                   dilation=3))