def make_group_generator(): # Note that this Variable is NOT going to show up in `net.parameters()` and # therefore it is implicitly free from the ridge penalty/p(theta) prior. log_sigma = Variable(torch.log(1e-2 * torch.ones(image_size)), requires_grad=True) return NormalNet(mu_net=torch.nn.Linear(group_input_dim, image_size), sigma_net=Lambda(lambda x, log_sigma: torch.exp( log_sigma.expand(x.size(0), -1)) + 1e-3, extra_args=(log_sigma, )))
A = torch.Tensor(A) data.append(A.view(-1)) temp = torch.stack([data[i] for i in range(len(data))]) X = torch.stack([temp for _ in range(num_samples)]) X += 0.05 * torch.randn(X.size()) X = X.transpose(0, 1) stddev_multiple = 0.1 inference_net = NormalNet(mu_net=nn.Sequential(nn.Linear(dim_h + dim_h, dim_z)), sigma_net=torch.nn.Sequential( nn.Linear(dim_h + dim_h, dim_z), Lambda(torch.exp), Lambda(lambda x: x * stddev_multiple + 1e-3))) def make_group_generator(): # Note that this Variable is NOT going to show up in `net.parameters()` and # therefore it is implicitly free from the ridge penalty/p(theta) prior. log_sigma = Variable(torch.log(1e-2 * torch.ones(image_size)), requires_grad=True) return NormalNet(mu_net=torch.nn.Sequential( torch.nn.Tanh(), torch.nn.Linear(group_input_dim, image_size)), sigma_net=Lambda(lambda x, log_sigma: torch.exp( log_sigma.expand(x.size(0), -1)) + 1e-3, extra_args=(log_sigma, )))