change dimensions of prior
" # Create unit normal priors over the parameters\n",
" x_data = data[:, :-1]\n",
" y_data = data[:, -1]\n",
- " mu, sigma = Variable(torch.zeros(p, 1)), Variable(10 * torch.ones(p, 1))\n",
+ " mu, sigma = Variable(torch.zeros(1, p)), Variable(10 * torch.ones(1, p))\n",
" bias_mu, bias_sigma = Variable(torch.zeros(1)), Variable(10 * torch.ones(1))\n",
" w_prior, b_prior = Normal(mu, sigma), Normal(bias_mu, bias_sigma)\n",
" priors = {'linear.weight': w_prior, 'linear.bias': b_prior}\n",
"\n",
"def guide(data):\n",
" # define our variational parameters\n",
- " w_mu = Variable(torch.randn(p, 1), requires_grad=True)\n",
+ " w_mu = Variable(torch.randn(1, p), requires_grad=True)\n",
" # note that we initialize our sigmas to be pretty narrow\n",
- " w_log_sig = Variable(-3.0 * torch.ones(p, 1) + 0.05 * torch.randn(p, 1), \n",
+ " w_log_sig = Variable(-3.0 * torch.ones(1, p) + 0.05 * torch.randn(1, p), \n",
" requires_grad=True)\n",
" b_mu = Variable(torch.randn(1), requires_grad=True)\n",
" b_log_sig = Variable(-3.0 * torch.ones(1) + 0.05 * torch.randn(1), \n",
