From dda12a242fe6ceb254f953a614b13833d8c6aa8f Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Tue, 24 Apr 2018 04:50:24 -0700 Subject: [PATCH] Change node_maker's param scope to block in op_test --- fluid/utils.py | 8 ++++---- tests/op_test.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fluid/utils.py b/fluid/utils.py index 378d32c68..6b4afe559 100644 --- a/fluid/utils.py +++ b/fluid/utils.py @@ -16,7 +16,7 @@ class UniqOpIOs(): - """Return unique input/output argument names for a operator. + """Return globally unique input/output argument names for a operator. """ def __init__(self): @@ -24,14 +24,14 @@ def __init__(self): 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. """ @@ -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. """ diff --git a/tests/op_test.py b/tests/op_test.py index 9e11a2b4b..22bae505b 100644 --- a/tests/op_test.py +++ b/tests/op_test.py @@ -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() @@ -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 @@ -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: