def compute_log_ais_weights(batch_size, free_energy_fn, sample_fn, betas):
 log_ais_w = numpy.zeros(batch_size, dtype=floatX)
 for i in range((len(betas) - 1)):
  (bp, bp1) = (betas[i], betas[(i + 1)])
  log_ais_w += (free_energy_fn(bp) - free_energy_fn(bp1))
  sample_fn(bp1)
  if ((i % 1000.0) == 0):
   logging.info(('Temperature %f ' % bp1))
 return log_ais_w

def compute_log_ais_weights ( batch_size , free_energy_fn , sample_fn , betas ) : log_ais_w = numpy . zeros ( batch_size , dtype = floatX ) for i in range ( ( len ( betas ) - 1 ) ) : ( bp , bp1 ) = ( betas [ i ] , betas [ ( i + 1 ) ] ) log_ais_w += ( free_energy_fn ( bp ) - free_energy_fn ( bp1 ) ) sample_fn ( bp1 ) if ( ( i % 1000.0 ) == 0 ) : logging . info ( ( 'Temperature %f ' % bp1 ) ) return log_ais_w
compute log of the ais weights parameters batch_size : scalar size of a batch of samples free_energy_fn : theano .