def decode(self, z, sigmoid=True): h1 = F.tanh(self.ld1(z)) h2 = self.ld2(h1) if sigmoid: return F.sigmoid(h2) else: return h2