Skip to content

Commit

Permalink
Simplify default key for root tensors.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Dec 23, 2016
1 parent 5a5f1fd commit a94863a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tfdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ def add(self, tensor, tf_sess=None, key=None, **kwargs):
tensor = Tensor(tensor, tf_sess, **kwargs)

if key is None:
key = len(self.roots)
while key in self.roots:
key += 1
if len(self.roots) == 0:
key = 0
else:
key = max(self.roots.keys()) + 1

self.roots[key] = tensor

Expand Down

0 comments on commit a94863a

Please sign in to comment.