tf_upgrade.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Stacked_LSTMS_Highway_Residual_On_TimeSeries_Datasets 作者: praveendareddy21 项目源码 文件源码
def visit_Attribute(self, node):  # pylint: disable=invalid-name
    """Handle bare Attributes i.e. [tf.foo, tf.bar].

    Args:
      node: Node that is of type ast.Attribute
    """
    full_name = self._get_attribute_full_path(node)
    if full_name and full_name.startswith("tf."):
      self._rename_functions(node, full_name)
    if full_name in self._api_change_spec.change_to_function:
      if not hasattr(node, "is_function_for_call"):
        new_text = full_name + "()"
        self._file_edit.add("Changed %r to %r"%(full_name, new_text),
                            node.lineno, node.col_offset, full_name, new_text)

    ast.NodeVisitor.generic_visit(self, node)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号