'Session' object has no attribute 'get_default_graph'

奇怪操作即标题

用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()获取图标识

你可能感兴趣的:(Tensorflow)