def run_reverse_ais(model, obs, state, num_steps, sigma, hdim, L, epsilon, data, prior, schedule=None): if schedule is None: schedule = ais.sigmoid_schedule(num_steps) path = AISPath(model, obs, 1, sigma, hdim, L, epsilon, data, prior, init_state=state) lld = ais.reverse_ais(path, schedule, sigma) return lld
def run_ais(model, obs, num_samples, num_steps, sigma, hdim, L, epsilon, prior, schedule=None, recog=None): if schedule is None: schedule = ais.sigmoid_schedule(num_steps) if recog: obs = obs.reshape(obs.shape[0], 3 * 32 * 32) obs_rep = np.tile(obs, [num_samples, 1]) rec_net = utils.load_recog(50, recog) state = rec_net(obs_rep) else: state = None path = AISPath(model, obs, num_samples, sigma, hdim, L, epsilon, prior, init_state=state) lld = ais.ais(path, schedule, sigma) return lld
def run_ais(model, obs, num_samples, num_steps, sigma, hdim, L, epsilon, data, schedule=None, init_state=None, mask=np.array([[0, 1]]), temp_range=(-4, 4)): if schedule is None: schedule = ais.sigmoid_schedule(num_steps, temp_range) path = AISPath(model, obs, num_samples, sigma, hdim, L, epsilon, data, mask, init_state=init_state) lld = ais.ais(path, schedule, sigma) return lld
def run_ais(model, obs, num_samples, num_steps, hdim, L, epsilon, schedule=None, init_state=None, save_dir='.', box=(60, 100, 60, 100), temp_range=(-4, 4)): if schedule is None: schedule = ais.sigmoid_schedule(num_steps, temp_range) path = AISPath(model, obs, num_samples, hdim, L, epsilon, box=box, init_state=init_state) lld = ais.ais(path, schedule, save_dir) return lld
def run_ais(model, obs, num_samples, num_steps, sigma, hdim, L, epsilon, data, prior, schedule=None): if schedule is None: schedule = ais.sigmoid_schedule(num_steps) mean = None log_sigma = None ## prior:recog <--If using the recognition nets to predict initial AIS chain. if prior[:5] == 'recog': 'load encoder net to predict initial dist...' obs = obs.reshape(obs.shape[0], 784) obs_rep = np.tile(obs, [num_samples, 1]) if prior[5] == '1': rec_net = utils.load_encoder('vae', 'c4000', eval_np=True) elif prior[5] == '2': rec_net = utils.load_encoder('iwae', '50', eval_np=True) state, mean, log_sigma = rec_net(obs_rep) else: state = None path = AISPath(model, obs, num_samples, sigma, hdim, L, epsilon, data, prior, init_state=state, recog_mean=mean, recog_log_sigma=log_sigma) lld = ais.ais(path, schedule, sigma) return lld