text_plain_output_1.png
import numpy as np

import torch

device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
a = 100
b = 100
dim_mesh = (a - 1) * (b - 1)
bias_bo = True
bias_bo_g = True
bias_bo_d = True
train_samples = 1200
end_samples = 1600
path = '../input/2stage-simon/f_set_nonl.npy'
ffine_all = 10000 * np.load(path)
print('ffine_all', np.shape(ffine_all))
ffine = ffine_all[:train_samples]
print('ffine', np.shape(ffine))
nb_samples = np.shape(ffine)[0]
nb_times = np.shape(ffine)[1]
fcoarse_reshape = np.reshape(ffine, (nb_samples, nb_times, a - 1, b - 1))
print('fcoarse_reshape', np.shape(fcoarse_reshape))
fcoarse_reshape_torch_before = torch.tensor(fcoarse_reshape, dtype=torch.float32, device=device)
print('fcoarse_reshape_torch_before', np.shape(fcoarse_reshape_torch_before))
ffine_test = ffine_all[train_samples:end_samples]
print('ffine_test', np.shape(ffine_test))
nb_samples_test = np.shape(ffine_test)[0]
nb_times_test = np.shape(ffine_test)[1]
fcoarse_reshape_test = np.reshape(ffine_test, (nb_samples_test, nb_times_test, a - 1, b - 1))
fcoarse_reshape_test_torch_before = torch.tensor(fcoarse_reshape_test, dtype=torch.float32, device=device)
print('fcoarse_reshape_test_torch_before', np.shape(fcoarse_reshape_test_torch_before))