コード例 #1
0

DNN2_net=MLP(DNN2_arch)
DNN2_net.cuda()


if pt_file!='none':
   print('LOADING MODEL.')
   checkpoint_load = torch.load(pt_file)
   CNN_net.load_state_dict(checkpoint_load['CNN_model_par'])
   DNN1_net.load_state_dict(checkpoint_load['DNN1_model_par'])
   DNN2_net.load_state_dict(checkpoint_load['DNN2_model_par'])



optimizer_CNN = optim.RMSprop(CNN_net.parameters(), lr=lr,alpha=0.95, eps=1e-8) 
optimizer_DNN1 = optim.RMSprop(DNN1_net.parameters(), lr=lr,alpha=0.95, eps=1e-8) 
optimizer_DNN2 = optim.RMSprop(DNN2_net.parameters(), lr=lr,alpha=0.95, eps=1e-8) 

# print("----------------------")
# print(DNN2_net(DNN1_net(CNN_net(3200))))

#for epoch in range(N_epochs):
  
test_flag=0
CNN_net.train()
DNN1_net.train()
DNN2_net.train()
 
loss_sum=0
err_sum=0
コード例 #2
0
    'fc_use_laynorm': class_use_laynorm,
    'fc_use_laynorm_inp': class_use_laynorm_inp,
    'fc_use_batchnorm_inp': class_use_batchnorm_inp,
    'fc_act': class_act,
}

DNN2_net = MLP(DNN2_arch)
DNN2_net.cuda()

if pt_file != 'none':
    checkpoint_load = torch.load(pt_file)
    CNN_net.load_state_dict(checkpoint_load['CNN_model_par'])
    DNN1_net.load_state_dict(checkpoint_load['DNN1_model_par'])
    DNN2_net.load_state_dict(checkpoint_load['DNN2_model_par'])

optimizer_CNN = optim.RMSprop(CNN_net.parameters(),
                              lr=lr,
                              alpha=0.95,
                              eps=1e-8)
optimizer_DNN1 = optim.RMSprop(DNN1_net.parameters(),
                               lr=lr,
                               alpha=0.95,
                               eps=1e-8)
optimizer_DNN2 = optim.RMSprop(DNN2_net.parameters(),
                               lr=lr,
                               alpha=0.95,
                               eps=1e-8)

for epoch in range(N_epochs):

    test_flag = 0