code: def bernoulli_log_density(targets, unnormalized_logprobs):
      # unnormalized_logprobs are in R
      # Targets must be -1 or 1
      label_probabilities = -np.logaddexp(
          0, -unnormalized_logprobs * targets
      )
      return np.sum(label_probabilities, axis=-1)
  
imports: from __future__ import absolute_import, division
  from __future__ import print_function
  import autograd.numpy
  import autograd.numpy.random
  import autograd.scipy.stats.norm
  from autograd.scipy.special import expit
  from autograd import grad
  from autograd.misc.optimizers import adam
  from data import load_mnist, save_images
label_desc: Use image node_id 4 for calling a global function with example usage: bernoulli_log_density(targets, unnormalized_logprobs) and returns: np