未验证 提交 1f032c53 编写于 作者: C Chen Weihang 提交者: GitHub

remove duplicate function, test=develop (#24849)

上级 a125697e
...@@ -117,7 +117,7 @@ class PrintTransformer(gast.NodeTransformer): ...@@ -117,7 +117,7 @@ class PrintTransformer(gast.NodeTransformer):
def _need_transform(self, var_node, print_node): def _need_transform(self, var_node, print_node):
if isinstance(var_node, gast.Name): if isinstance(var_node, gast.Name):
if self._is_tensor_node(var_node): if self.static_analysis_visitor.is_tensor_node(var_node):
return True return True
else: else:
_logger.warning( _logger.warning(
...@@ -128,11 +128,3 @@ class PrintTransformer(gast.NodeTransformer): ...@@ -128,11 +128,3 @@ class PrintTransformer(gast.NodeTransformer):
"ProgramTranslator could not transform < %s > now and will run it as-is." "ProgramTranslator could not transform < %s > now and will run it as-is."
% ast_to_source_code(print_node).strip()) % ast_to_source_code(print_node).strip())
return False return False
def _is_tensor_node(self, node):
tensor_types = {NodeVarType.TENSOR, NodeVarType.PADDLE_RETURN_TYPES}
wrapper_node = self.node_to_wrapper_map.get(node, None)
if wrapper_node is not None:
if wrapper_node.node_var_type & tensor_types:
return True
return False
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册