当前位置: 首页>>代码示例>>Python>>正文


Python session.BaseSession方法代码示例

本文整理汇总了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 
开发者ID:snuspl,项目名称:parallax,代码行数:23,代码来源:session_context.py

示例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 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:11,代码来源:framework.py

示例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


注:本文中的tensorflow.python.client.session.BaseSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。