奇怪操作即標題
用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']
得出結(jié)論陈莽,此版本提示有bug褒傅,如遇此問題磺平,請用sess.graph()獲取圖標識
最后解決不了的同學請放棄直接學習TF2.0版本创倔!