Skip to content

Commit

Permalink
remove unused lines from svae.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjj committed Apr 21, 2016
1 parent fa4a4ab commit a89e886
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions svae/svae.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from util import add, sub, contract, scale, unbox


def make_gradfun(run_inference, recognize, loglike, eta_prior, return_flat=False):
def make_gradfun(run_inference, recognize, loglike, eta_prior):
saved = lambda: None

def mc_vlb(eta, phi, psi, y_n, N, L):
T = y_n.shape[0]
nn_potentials = recognize(y_n, psi)
samples, stats, global_vlb, local_vlb = run_inference(
eta_prior, eta, nn_potentials, num_samples=L)
Expand All @@ -20,11 +19,4 @@ def gradfun(y_n, N, L, eta, phi, psi):
eta_natgrad = sub(add(eta_prior, saved.stats), eta)
return vlb, (eta_natgrad, phi_grad, psi_grad)

def flat_gradfun(y_n, N, L, eta, phi, psi):
objective = lambda (eta, phi, psi): mc_vlb(eta, phi, psi, y_n, N, L)
return vgrad(objective)((eta, phi, psi))

if return_flat:
return gradfun, flat_gradfun

return gradfun

0 comments on commit a89e886

Please sign in to comment.