Exemplo n.º 1
0
 def __init__(self, input_size, hidden_size, latent_size):
     super().__init__()
     self.samplelayer = NormalDistributed(latent_size=latent_size)
     self.linear = nn.Linear(input_size, hidden_size)
     self.batch_norm = nn.BatchNorm1d(hidden_size, momentum=0.1)
     self.h2z = nn.Linear(hidden_size, self.samplelayer.inputShape()[-1])
     self.elu = nn.ELU()
Exemplo n.º 2
0
 def __init__(self, input_size, hidden_size, latent_size):
     super().__init__()
     self.samplelayer = NormalDistributed(latent_size=latent_size)
     self.conv = nn.Conv1d(in_channels=input_size,
                           out_channels=hidden_size,
                           kernel_size=3)
     self.batch_norm = nn.BatchNorm1d(hidden_size, momentum=0.1)
     self.h2z = nn.Linear(hidden_size, self.samplelayer.inputShape()[-1])
     self.elu = nn.ELU()
Exemplo n.º 3
0
    def __init__(self, input_size, hidden_size, latent_size):
        super().__init__()
        self.samplelayer1 = GaussianMerge(latent_size=latent_size)
        self.linear1 = nn.Linear(input_size, hidden_size)
        self.batch_norm1 = nn.BatchNorm1d(hidden_size, momentum=0.1)
        self.h2z1 = nn.Linear(hidden_size, self.samplelayer1.inputShape()[-1])

        self.samplelayer2 = NormalDistributed(latent_size=latent_size)
        self.linear2 = nn.Linear(input_size, hidden_size)
        self.batch_norm2 = nn.BatchNorm1d(hidden_size, momentum=0.1)
        self.h2z2 = nn.Linear(hidden_size, self.samplelayer2.inputShape()[-1])

        self.elu = nn.ELU()
Exemplo n.º 4
0
    def __init__(self, input_size, hidden_size, latent_size):
        super().__init__()
        self.samplelayer1 = GaussianMerge(latent_size=latent_size)
        self.conv1 = nn.ConvTranspose1d(in_channels=input_size,
                                        out_channels=hidden_size,
                                        kernel_size=3)
        self.batch_norm1 = nn.BatchNorm1d(hidden_size, momentum=0.1)
        self.h2z1 = nn.Linear(hidden_size, self.samplelayer1.inputShape()[-1])

        self.samplelayer2 = NormalDistributed(latent_size=latent_size)
        self.conv2 = nn.ConvTranspose1d(in_channels=input_size,
                                        out_channels=hidden_size,
                                        kernel_size=3)
        self.batch_norm2 = nn.BatchNorm1d(hidden_size, momentum=0.1)
        self.h2z2 = nn.Linear(hidden_size, self.samplelayer2.inputShape()[-1])

        self.elu = nn.ELU()
Exemplo n.º 5
0
	def __init__(self,input_size,rnn_size,latent_size,output_size,use_softmax=False):
		super().__init__()
		"""
		Layer definitions
		"""
		self.aux_loss = False
		self.kl_loss = False
		# sample layer with normal distribution
		self.samplelayer = NormalDistributed(latent_size=latent_size)
		# encode from input space to hidden space
		self.encoder = RNNEncoder(input_size=input_size,rnn_size=rnn_size)
		# encoded to latent layer
		self.h2z = nn.Sequential(
			nn.Linear(rnn_size,self.samplelayer.inputShape()[-1]),
			nn.ELU()
			)
		# latent to decoded layer
		self.z2h = nn.Sequential(
			nn.Linear(self.samplelayer.outputShape()[-1],rnn_size),
			nn.ELU()
			)
		# decode from hidden space to input space
		self.decoder = RNNDecoder(input_size=input_size,rnn_size=rnn_size,output_size=output_size,use_softmax=use_softmax)