Exemplo n.º 1
0
test_X_std = (test_X - Xmean) / Xstd
#test_Y_std = (test_Y - Xmean) / Xstd

######################################
# Network Setting
#batch_size = args.batch
batch_size = 1  #512
#criterion = nn.BCELoss()
criterion = nn.MSELoss()

#Creat Model
#model = modelZoo.autoencoder_first().cuda()
featureDim = test_X_raw.shape[2]
latentDim = 200
model = modelZoo.autoencoder_3conv_vect_vae(featureDim, latentDim).cuda()
model.eval()

#Creat Model
trainResultName = checkpointFolder + preTrainFileName
loaded_state = torch.load(trainResultName,
                          map_location=lambda storage, loc: storage)

model.load_state_dict(
    loaded_state,
    strict=False)  #strict False is needed some version issue for batchnorm
model = model.eval()  #Do I need this again?

# Ystd = np.swapaxes(Ystd,1,2)
# Ymean = np.swapaxes(Ymean,1,2)
Exemplo n.º 2
0
#Ystd = preprocess['Ystd']

# test_X_std = (test_X - Xmean) / Xstd
#test_Y_std = (test_Y - Xmean) / Xstd

######################################
# Network Setting
#batch_size = args.batch
batch_size = 1  #512
#criterion = nn.BCELoss()
criterion = nn.MSELoss()

#Creat Model
#model = modelZoo.autoencoder_first(featureDim).cuda()
#model = modelZoo.autoencoder_1conv_vect_vae(featureDim).cuda()
model = modelZoo.autoencoder_3conv_vect_vae(featureDim, 100).cuda()
model.eval()

#Creat Model
trainResultName = checkpointFolder + preTrainFileName
loaded_state = torch.load(trainResultName,
                          map_location=lambda storage, loc: storage)

model.load_state_dict(
    loaded_state,
    strict=False)  #strict False is needed some version issue for batchnorm
model = model.eval()  #Do I need this again?

# Ystd = np.swapaxes(Ystd,1,2)
# Ymean = np.swapaxes(Ymean,1,2)