def forward(self, z):
output = self.model(z.view(z.size(0), -1, 1, 1))
mu, log_var = output[:, 0:1], output[:, 1:2]
- # log_var.flatten(1)[...]=log_var.flatten(1)[:,:1]
+ log_var.flatten(1)[...] = log_var.flatten(1)[:, :1]
return mu, log_var
param_p_X_given_z = model_p_X_given_z(z)
x = sample_gaussian(param_p_X_given_z)
save_image(x, "output.png")
+save_image(param_p_X_given_z[0], "output_mean.png")
# Generate a bunch of images
z = sample_gaussian(
- param_p_Z[0].expand(x.size(0), -1), param_p_Z[1].expand(x.size(0), -1)
+ (param_p_Z[0].expand(x.size(0), -1), param_p_Z[1].expand(x.size(0), -1))
)
param_p_X_given_z = model_p_X_given_z(z)
x = sample_gaussian(param_p_X_given_z)
save_image(x, "synth.png")
+save_image(param_p_X_given_z[0], "synth_mean.png")
######################################################################