美文网首页
'Session' object has no attribut

'Session' object has no attribut

作者: 小灰灰_5c75 | 来源:发表于2019-03-14 16:27 被阅读0次

    奇怪操作即标题

    用jupter notebook写with tf.Session() as sess:后再写

    sess.get 此时Shift+Tab自动提示会补全为get_default_graph

    这个东西不存在!

    dir(sess)查看其中方法:

    ['_Callable', '_DEAD_HANDLES_THRESHOLD',
    '_NODEDEF_NAME_RE', 'class',
    'del', 'delattr', 'dict', 'dir',
    'doc', 'enter',
    'eq', 'exit', 'format', 'ge',
    'getattribute', 'gt',
    'hash', 'init', 'le', 'lt',
    'module', 'ne',
    'new', 'reduce', 'reduce_ex',
    'repr', 'setattr',
    'sizeof', 'str', 'subclasshook',
    'weakref',
    '_add_shapes', '_call_tf_sessionprun',
    '_call_tf_sessionrun',
    '_closed', '_config',
    '_current_version', '_dead_handles',
    '_default_graph_context_manager',
    '_default_session_context_manager',
    '_delete_lock',
    '_do_call', '_do_run',
    '_extend_graph', '_extend_lock', '_graph',
    '_make_callable_from_options',
    '_opened', '_register_dead_handle', '_run',
    '_session', '_target',
    '_tf_api_names', '_tf_api_names_v1',
    '_update_with_movers', 'as_default',
    'close', 'graph', 'graph_def',
    'list_devices', 'make_callable',
    'partial_run', 'partial_run_setup',
    'reset', 'run', 'sess_str']

    得出结论,此版本提示有bug,如遇此问题,请用sess.graph()获取图标识

    最后解决不了的同学请放弃直接学习TF2.0版本!

    相关文章

      网友评论

          本文标题:'Session' object has no attribut

          本文链接:https://www.haomeiwen.com/subject/plrcmqtx.html