if torch.cuda.is_available(): del x_u, y_u, x_f, y_f, u, u_x, u_xx, k, pred_u, pred_k, pred_f torch.cuda.empty_cache() return ll, output # sampling params_hmc = util.sample_model_bpinns(nets, data, model_loss=model_loss, num_samples=num_samples, num_steps_per_sample=L, step_size=step_size, burn=burn, tau_priors=tau_priors, tau_likes=tau_likes, device=device, n_params_single=n_params_single, pde=pde, pinns=pinns, epochs=epochs) pred_list, log_prob_list = util.predict_model_bpinns( nets, params_hmc, data_val, model_loss=model_loss, tau_priors=tau_priors, tau_likes=tau_likes, n_params_single=n_params_single,
elif method == 'BO': del MSE_BO torch.cuda.empty_cache() return ll, output # regression params_init_val = None params_hmc = util.sample_model_bpinns(nets, data, model_loss=model_loss, step_size=step_size, device=device, pde=True, pinns=True, epochs=epochs, params_init_val=params_init_val) pred_list, log_prob_list = util.predict_model_bpinns(nets, params_hmc, data_val, model_loss=model_loss, pde=True) print('\nExpected validation log probability: {:.3f}'.format( torch.stack(log_prob_list).mean())) pred_list_u = pred_list[0].cpu().numpy()