本文整理匯總了Python中tensorflow.python.client.session.BaseSession方法的典型用法代碼示例。如果您正苦於以下問題:Python session.BaseSession方法的具體用法?Python session.BaseSession怎麽用?Python session.BaseSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tensorflow.python.client.session
的用法示例。
在下文中一共展示了session.BaseSession方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: set_parallax_session_context
# 需要導入模塊: from tensorflow.python.client import session [as 別名]
# 或者: from tensorflow.python.client.session import BaseSession [as 別名]
def set_parallax_session_context(self):
self.old_run = getattr(session.BaseSession, 'run', None)
self.old_init = getattr(session.BaseSession, '__init__', None)
if not self.old_run:
raise tf.errors.InternalError(None, None, 'BaseSession misses run method.')
elif not self.old_init:
raise tf.errors.InternalError(None, None,
'BaseSession misses __init__ method.')
elif getattr(session.BaseSession, '_run_internal', None):
raise tf.errors.InternalError(None, None,
'Already in context or context not cleaned.')
elif getattr(session.BaseSession, '_init_internal', None):
raise tf.errors.InternalError(None, None,
'Already in context or context not cleaned.')
else:
setattr(session.BaseSession, 'run', _parallax_run)
setattr(session.BaseSession, '__init__', _parallax_init)
setattr(session.BaseSession, '_run_internal', self.old_run)
setattr(session.BaseSession, '_init_internal', self.old_init)
setattr(session.BaseSession, 'parallax_session_context', self)
return self
示例2: __enter__
# 需要導入模塊: from tensorflow.python.client import session [as 別名]
# 或者: from tensorflow.python.client.session import BaseSession [as 別名]
def __enter__(self):
self.old_run = getattr(session.BaseSession, 'run', None)
self.old_init = getattr(session.BaseSession, '__init__', None)
if not self.old_run:
raise errors.InternalError(None, None, 'BaseSession misses run method.')
elif not self.old_init:
raise errors.InternalError(None, None,
'BaseSession misses __init__ method.')
elif getattr(session.BaseSession, '_profiler_run_internal', None):
raise errors.InternalError(None, None,
'Already in context or context not cleaned.')
elif getattr(session.BaseSession, '_profiler_init_internal', None):
raise errors.InternalError(None, None,
'Already in context or context not cleaned.')
else:
setattr(session.BaseSession, 'run', _profiled_run)
setattr(session.BaseSession, '__init__', _profiled_init)
setattr(session.BaseSession, '_profiler_run_internal', self.old_run)
setattr(session.BaseSession, '_profiler_init_internal', self.old_init)
setattr(session.BaseSession, 'profile_context', self)
return self
開發者ID:PacktPublishing,項目名稱:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代碼行數:23,代碼來源:profile_context.py
示例3: __init__
# 需要導入模塊: from tensorflow.python.client import session [as 別名]
# 或者: from tensorflow.python.client.session import BaseSession [as 別名]
def __init__(self, sess):
"""Constructor.
Args:
sess: A tensorflow Session object.
"""
_check_type(sess, session.BaseSession)
self.session = sess
示例4: __init__
# 需要導入模塊: from tensorflow.python.client import session [as 別名]
# 或者: from tensorflow.python.client.session import BaseSession [as 別名]
def __init__(self, sess):
"""Constructor.
Args:
sess: A tensorflow Session object.
"""
_check_type(sess, (session.BaseSession, monitored_session.MonitoredSession))
self.session = sess
開發者ID:PacktPublishing,項目名稱:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代碼行數:11,代碼來源:framework.py
示例5: __exit__
# 需要導入模塊: from tensorflow.python.client import session [as 別名]
# 或者: from tensorflow.python.client.session import BaseSession [as 別名]
def __exit__(self, exec_type, exec_value, exec_tb):
print_mdl.DeleteProfiler()
setattr(session.BaseSession, 'run', self.old_run)
setattr(session.BaseSession, '__init__', self.old_init)
setattr(session.BaseSession, '_profiler_run_internal', None)
setattr(session.BaseSession, '_profiler_init_internal', None)
setattr(session.BaseSession, 'profile_context', None)
開發者ID:PacktPublishing,項目名稱:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代碼行數:9,代碼來源:profile_context.py