Skip to content

Commit

Permalink
Merge pull request BVLC#18 from lmthang/dev
Browse files Browse the repository at this point in the history
Add param_set to apollocaffe.update
  • Loading branch information
Russell Stewart authored and Russell Stewart committed Oct 4, 2015
2 parents 7d4c0b7 + afa080c commit 30618fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/apollocaffe/cpp/_apollocaffe.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,16 @@ cdef class ApolloNet:
def backward(self):
for layer_name in self.active_layer_names()[::-1]:
self.backward_layer(layer_name)
def update(self, lr, momentum=0., clip_gradients=-1, weight_decay=0.):
def update(self, lr, momentum=0., clip_gradients=-1, weight_decay=0., param_set=None):
diffnorm = self.diff_l2_norm()
clip_scale = 1.
if clip_gradients > 0:
if diffnorm > clip_gradients:
clip_scale = clip_gradients / diffnorm
params = self.params
for param_name in self.active_param_names():
if param_set is None:
param_set = self.active_param_names()
for param_name in param_set:
self.update_param(params[param_name],
lr * clip_scale * self.param_lr_mults(param_name),
momentum,
Expand Down

0 comments on commit 30618fe

Please sign in to comment.