Skip to content

Commit

Permalink
Merge pull request #2 from ictxiangxin/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
lxm authored Apr 14, 2017
2 parents 520f524 + d28d4f2 commit aa834e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions paradox/kernel/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,14 @@ def __compute_gradient(self, variable: Symbol):
if hash(self.__symbol) == hash(variable):
self.__gradients[variable] = broadcast(Constant(1), self.shape(self.__symbol))
return
current_operator = None
for forward in variable.output:
if self.gradient(forward) is not None:
if current_operator != forward.operator:
current_operator = forward.operator
index = -1
gradients = forward.operator.gradient(self, forward, *forward.input)
index = None
for i, _variable in enumerate(forward.input):
for i, _variable in enumerate(forward.input, start=index + 1):
if hash(_variable) == hash(variable):
index = i
break
Expand Down

0 comments on commit aa834e1

Please sign in to comment.