def training_updates(visible_batch, model, sampler, optimizer):
 sampler_updates = sampler.updates()
 pos_v = visible_batch
 neg_v = sampler.particles
 grads = model.ml_gradients(pos_v, neg_v)
 ups = optimizer.updates(gradients=grads)
 safe_update(ups, sampler_updates)
 return ups

def training_updates ( visible_batch , model , sampler , optimizer ) : sampler_updates = sampler . updates ( ) pos_v = visible_batch neg_v = sampler . particles grads = model . ml_gradients ( pos_v , neg_v ) ups = optimizer . updates ( gradients = grads ) safe_update ( ups , sampler_updates ) return ups
combine together updates from various sources for rbm training .