예제 #1
0
    def set_weights(self, weights):
        if hasattr(self, 'save_parm'):
            params = self.params + self.save_parm
        else:
            params = self.params

        for p, w in zip(params, weights):
            # print(p.name)
            if p.eval().shape != w.shape:
                raise Exception("Layer shape %s not compatible with weight shape %s." % (p.eval().shape, w.shape))
            p.set_value(floatX(w))
 def set_state(self, value_list):
     assert len(self.updates) == len(value_list)
     for u, v in zip(self.updates, value_list):
         u[0].set_value(floatX(v))