Skip to content

Commit

Permalink
Fix function of graph wrapper. (PaddlePaddle#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghaoshuang authored Jan 14, 2020
1 parent 06eef98 commit d7e074c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion paddleslim/core/graph_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def outputs(self):
def is_parameter(self):
return isinstance(self._var, Parameter)


class OpWrapper(object):
def __init__(self, op, graph):
assert isinstance(graph, GraphWrapper)
Expand Down Expand Up @@ -270,7 +271,10 @@ def var(self, name):
"""
Get the variable by variable name.
"""
return VarWrapper(self.program.global_block().var(name), self)
for block in self.program.blocks:
if block.has_var(name):
return VarWrapper(block.var(name), self)
return None

def clone(self, for_test=False):
"""
Expand Down

0 comments on commit d7e074c

Please sign in to comment.