Example #1
0
 def grad_fn(self, theta, xt):
     old_params = get_flat_params(self)
     set_flat_params(self, theta)
     grad = self.grad(xt)
     set_flat_params(old_params)
     return grad
Example #2
0
 def add_to_params(self, grad):
     params = get_flat_params(self)
     set_flat_params(self, params + grad)
Example #3
0
 def pred_fn(self, theta, xt):
     old_params = get_flat_params(self)
     set_flat_params(self, theta)
     v = self.predict(xt)
     set_flat_params(old_params)
     return v
Example #4
0
 def get_params(self):
     return get_flat_params(self)