Skip to content

Commit

Permalink
Change node_maker's param scope to block in op_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yibing Liu committed Apr 24, 2018
1 parent 222e1c6 commit dda12a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions fluid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@


class UniqOpIOs():
"""Return unique input/output argument names for a operator.
"""Return globally unique input/output argument names for a operator.
"""

def __init__(self):
self._all_renamed_outputs = {}
self._renamed_cnt = 0

def get_new_name(self, arg):
"""Get the new name for the an argument.
"""Get the new name for an argument.
"""

self._renamed_cnt += 1
return arg + '@dup_' + str(self._renamed_cnt)

def rename_input_args(self):
"""Rename input arguments if their previous output arugments has been
"""Rename input arguments if their previous output arugments have been
renamed.
"""

Expand All @@ -41,7 +41,7 @@ def rename_input_args(self):
in_name][0]]

def rename_output_args(self):
"""Rename output arguments if they have same name with the input
"""Rename output arguments if they have same names with the input
arguments.
"""

Expand Down
7 changes: 3 additions & 4 deletions tests/op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ def eval_fluid_op(self):
# Create a new paddle scope and program.
place = core.CPUPlace()
exe = Executor(place)
self.scope = core.Scope()
scope = core.Scope()

with scope_guard(self.scope):
with scope_guard(scope):
program = Program()
self.block = program.global_block()

Expand Down Expand Up @@ -227,7 +227,6 @@ def eval_fluid_op(self):

outs = exe.run(program,
feed=self.feed_map,
scope=self.scope,
fetch_list=self.fetch_list,
return_numpy=True)
return outs
Expand Down Expand Up @@ -255,7 +254,7 @@ def eval_onnx_node(self):
]

# Construct the ONNX model using paddle-onnx.
onnx_node = node_maker[self.op_type](operator=self.op, scope=self.scope)
onnx_node = node_maker[self.op_type](operator=self.op, block=self.block)
node_list = list(onnx_node) if isinstance(onnx_node,
tuple) else [onnx_node]
for node in node_list:
Expand Down

0 comments on commit dda12a2

Please sign in to comment.