Beispiel #1
0
 def save_data(self):
     if not self.debug_mode:
         BasicFunctions_szz.save_pr(
             self.program_info['path_save'],
             self.program_info['save_name'],
             [self.tensor_data, self.tensor_info, self.update_info],
             ['tensor_data', 'tensor_info', 'update_info'])
Beispiel #2
0
 def save_data(self):
     if not self.debug_mode:
         BasicFunctions_szz.save_pr(
             self.program_info['path_save'], self.program_info['save_name'],
             [
                 self.weight, self.tensor_info, self.update_info,
                 self.tensor_shape, self.para
             ], [
                 'weight', 'tensor_info', 'update_info', 'tensor_shape',
                 'para'
             ])
Beispiel #3
0
 def __init__(self, device='cuda', dtype=torch.float64, debug_mode=False):
     self.debug_mode = debug_mode
     self.program_info = dict()
     self.device_type = device
     self.device = BasicFunctions_szz.get_best_gpu(device=device)
     self.dtype = dtype
     self.calculate_program_info_time(mode='start')
Beispiel #4
0
 def load_weight(self):
     load_path = self.program_info['path_save'] + self.program_info[
         'save_name']
     if os.path.isfile(load_path):
         self.weight, self.tensor_info, self.update_info, self.tensor_shape = \
             BasicFunctions_szz.load_pr(load_path, ['weight', 'tensor_info', 'update_info', 'tensor_shape'])
         self.weight.data = self.weight.data.to(self.device)
Beispiel #5
0
 def print_program_info(self, mode='start'):
     if mode == 'start':
         print('This program starts at ' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
         print(BasicFunctions_szz.sort_dict(self.para))
     elif mode == 'end':
         print('This program ends at ' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
         print(
             'This program consumes ' +
             str(self.program_info['end_time']['time'] - self.program_info['start_time']['time']) +
             ' seconds of wall time.')
Beispiel #6
0
 def save_data(self):
     BasicFunctions_szz.save_pr(self.program_info['path_save'],
                                self.program_info['save_name'],
                                [self.accuracy, self.test_info],
                                ['accuracy', 'test_info'])
Beispiel #7
0
 def load_accuracy(self):
     load_path = self.program_info['path_save'] + self.program_info[
         'save_name']
     if os.path.isfile(load_path):
         self.accuracy, self.test_info = BasicFunctions_szz.load_pr(
             load_path, ['accuracy', 'test_info'])
Beispiel #8
0
 def load_gtn(self):
     load_path = self.program_info['path_save'] + self.program_info[
         'save_name']
     if os.path.isfile(load_path):
         self.tensor_data, self.tensor_info, self.update_info = \
             BasicFunctions_szz.load_pr(load_path, ['tensor_data', 'tensor_info', 'update_info'])
Beispiel #9
0
 def integrate_codebook(self):
     BasicFunctions_szz.integrate_codebook(
         self.program_info['path_save'], self.program_info['program_name'])
Beispiel #10
0
 def name_md5_generate(self):
     self.program_info['save_name'] = BasicFunctions_szz.name_generator_md5(
         self.program_info['path_save'], self.program_info['program_name'],
         self.para, rough_mode=self.para['rough_mode'])
Beispiel #11
0
 def name_md5_generate(self):
     if not self.debug_mode:
         self.program_info[
             'save_name'] = BasicFunctions_szz.name_generator_md5(
                 self.program_info['path_save'],
                 self.program_info['program_name'], self.para)