Skip to content

Commit

Permalink
fix the issue(apache#14468):'float' object is not subscriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxun-zhang committed Mar 24, 2019
1 parent 056fce4 commit af7ab07
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions example/ssd/train/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ def reset(self):
"""
override reset behavior
"""
if getattr(self, 'num', None) is None:
self.num_inst = 0
self.sum_metric = 0.0
self.global_num_inst = 0
self.global_sum_metric = 0.0
else:
self.num_inst = [0] * self.num
self.sum_metric = [0.0] * self.num
self.global_num_inst = [0] * self.num
self.global_sum_metric = [0.0] * self.num

def reset_local(self):
"""
override reset_local behavior
"""
if getattr(self, 'num', None) is None:
self.num_inst = 0
self.sum_metric = 0.0
Expand Down

0 comments on commit af7ab07

Please sign in to comment.