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


Python dragnn_ops.release_session方法代码示例

本文整理汇总了Python中dragnn.python.dragnn_ops.release_session方法的典型用法代码示例。如果您正苦于以下问题:Python dragnn_ops.release_session方法的具体用法?Python dragnn_ops.release_session怎么用?Python dragnn_ops.release_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dragnn.python.dragnn_ops的用法示例。


在下文中一共展示了dragnn_ops.release_session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_warmup_graph

# 需要导入模块: from dragnn.python import dragnn_ops [as 别名]
# 或者: from dragnn.python.dragnn_ops import release_session [as 别名]
def build_warmup_graph(self, asset_dir):
    """Builds a warmup graph.

    This graph performs a MasterSpec asset location rewrite via
    SetAssetDirectory, then grabs a ComputeSession and immediately returns it.
    By grabbing a session, we cause the underlying transition systems to cache
    their static data reads.

    Args:
      asset_dir: The base directory to append to all resources.

    Returns:
      A single op suitable for passing to the legacy_init_op of the ModelSaver.
    """
    with tf.control_dependencies([dragnn_ops.set_asset_directory(asset_dir)]):
      session = self._get_compute_session()
      release_op = dragnn_ops.release_session(session)
    return tf.group(release_op, name='run') 
开发者ID:rky0930,项目名称:yolo_v2,代码行数:20,代码来源:graph_builder.py

示例2: _outputs_with_release

# 需要导入模块: from dragnn.python import dragnn_ops [as 别名]
# 或者: from dragnn.python.dragnn_ops import release_session [as 别名]
def _outputs_with_release(self, handle, inputs, outputs):
    """Ensures ComputeSession is released before outputs are returned.

    Args:
      handle: Handle to ComputeSession on which all computation until now has
          depended. It will be released and assigned to the output 'run'.
      inputs: list of nodes we want to pass through without any dependencies.
      outputs: list of nodes whose access should ensure the ComputeSession is
          safely released.

    Returns:
      A dictionary of both input and output nodes.
    """
    with tf.control_dependencies(outputs.values()):
      with tf.name_scope('ComputeSession'):
        release_op = dragnn_ops.release_session(handle)
      run_op = tf.group(release_op, name='run')
      for output in outputs:
        with tf.control_dependencies([release_op]):
          outputs[output] = tf.identity(outputs[output], name=output)
    all_nodes = inputs.copy()
    all_nodes.update(outputs)

    # Add an alias for simply running without collecting outputs.
    # Common, for instance, with training.
    all_nodes['run'] = run_op
    return all_nodes 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:29,代码来源:graph_builder.py


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