(self, input_tensor)
| 130 | return torch.mean(input_tensor, dim=-2) |
| 131 | |
| 132 | def z_encode(self, input_tensor): |
| 133 | hidden = torch.relu(self.z_to_hidden(input_tensor)) |
| 134 | mu = self.hidden_to_mu(hidden) |
| 135 | log_sigma = self.hidden_to_logsigma(hidden) |
| 136 | std = torch.exp(0.5 * log_sigma) |
| 137 | eps = torch.randn_like(std) |
| 138 | z = eps.mul(std).add_(mu) |
| 139 | return z, mu, log_sigma |
| 140 | |
| 141 | def encoder(self, input_tensor): |
| 142 | z_ = self.emb_encode(input_tensor) |