Example #1
0
 def load_params(self, filename):
     r = p.load(filename)
     self.epsilon = r['epsilon']
     self.parameters['gamma'] = r['gamma']
     self.parameters['beta'] = r['beta']
     self.running_mean = r['running_mean']
     self.running_var = r['running_var']
     self.sqrtvar = r['sqrtvar']
Example #2
0
    def load_parameters(self, path):
        v = p.load(path + os.sep + self.name + '_v.npz')
        if isinstance(v, numpy.lib.npyio.NpzFile):
            files = v.files
        else:
            files = v.npz_file.files

        for key in files:
            self.v[key] = v[key]
        s = p.load(path + os.sep + self.name + '_s.npz')

        if isinstance(s, numpy.lib.npyio.NpzFile):
            files = s.files
        else:
            files = s.npz_file.files
        for key in files:
            self.s[key] = s[key]
Example #3
0
 def load_params(self, path):
     dic = load_struct_params(path + os.sep + self.name + '_struct.obj')
     self.unit_number = dic['unit_number']
     self.activation = dic['activation']
     if dic['batchNormal']:
         self.batch_normal = BatchNormal()
         self.batch_normal.load_params(path + os.sep + self.name + '_batch_normal.npz')
     r = p.load(path + os.sep + self.name + '.npz')
     self.parameters['W'] = r['W']
     self.parameters['b'] = r['b']
Example #4
0
    def load_params(self, path):
        dic = load_struct_params(path + os.sep + self.name + '_struct.obj')
        self.unit_number = dic['unit_number']
        r = p.load(path + os.sep + self.name + '.npz')
        if isinstance(r, numpy.lib.npyio.NpzFile):
            files = r.files
        else:
            files = r.npz_file.files

        for key in files:
            self.parameters[key] = r[key]
Example #5
0
    def load_params(self, path):
        dic = load_struct_params(path + os.sep + self.name + '_struct.obj')
        self.word_to_idx = dic['word_to_idx']
        self.n_a = dic['n_a']

        r = p.load(path + os.sep + self.name + '.npz')
        if isinstance(r, numpy.lib.npyio.NpzFile):
            files = r.files
        else:
            files = r.npz_file.files
        for key in files:
            self.parameters[key] = r[key]
Example #6
0
 def load_params(self, path):
     params = p.load(path + os.sep + self.name + '.npz')
     dic = load_struct_params(path + os.sep + self.name + '_struct.obj')
     self.filter_count = dic['filter_count']
     self.filter_shape = dic['filter_shape']
     self.stride = dic['stride']
     self.padding = dic['padding']
     self.activation = dic['activation']
     self.parameters['W'] = params['W']
     self.parameters['b'] = params['b']
     if dic['batchNormal']:
         self.batch_normal = BatchNormal()
         self.batch_normal.load_params(path + os.sep + self.name + '_batch_normal.npz')
Example #7
0
 def load_params(self, path):
     params = p.load(path + os.sep + self.name + '.npz')
     dic = load_struct_params(path + os.sep + self.name + '_struct.obj')
     self.vocab_size = dic['vocab_size']
     self.word_dim = dic['word_dim']
     self.parameters['W'] = params['W']