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


Python session.run方法代码示例

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


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

示例1: on_run_start

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def on_run_start(self, request):
    """Callback invoked on run() calls to the debug-wrapper session.

    This is a blocking callback.
    The invocation happens after the wrapper's run() call is entered,
    after an increment of run call counter.

    Args:
      request: (OnRunStartRequest) callback request object carrying information
        about the run call such as the fetches, feed dict, run options, run
        metadata, and how many run() calls to this wrapper session has occurred.

    Returns:
      An instance of OnRunStartResponse, carrying information to
        1) direct the wrapper session to perform a specified action (e.g., run
          with or without debug tensor watching, invoking the stepper.)
        2) debug URLs used to watch the tensors.
    """
    pass 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:21,代码来源:framework.py

示例2: __init__

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def __init__(self, fetches, feed_dict, run_options, run_metadata,
               run_call_count):
    """Constructor of `OnRunStartRequest`.

    Args:
      fetches: Fetch targets of the run() call.
      feed_dict: The feed dictionary to the run() call.
      run_options: RunOptions input to the run() call.
      run_metadata: RunMetadata input to the run() call.
        The above four arguments are identical to the input arguments to the
        run() method of a non-wrapped TensorFlow session.
      run_call_count: 1-based count of how many run calls (including this one)
        has been invoked.
    """
    self.fetches = fetches
    self.feed_dict = feed_dict
    self.run_options = run_options
    self.run_metadata = run_metadata
    self.run_call_count = run_call_count 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:21,代码来源:framework.py

示例3: on_run_start

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def on_run_start(self, request):
    """Callback invoked on run() calls to the debug-wrapper session.

    This is a blocking callback.
    The invocation happens after the wrapper's run() call is entered,
    after an increment of run call counter.

    Args:
      request: (`OnRunStartRequest`) callback request object carrying
        information about the run call such as the fetches, feed dict, run
        options, run metadata, and how many `run()` calls to this wrapper
        session have occurred.

    Returns:
      An instance of `OnRunStartResponse`, carrying information to
        1) direct the wrapper session to perform a specified action (e.g., run
          with or without debug tensor watching, invoking the stepper.)
        2) debug URLs used to watch the tensors.
    """ 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:21,代码来源:framework.py

示例4: invoke_node_stepper

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def invoke_node_stepper(self,
                          node_stepper,
                          restore_variable_values_on_exit=True):
    """Callback invoked when the client intends to step through graph nodes.

    Args:
      node_stepper: (stepper.NodeStepper) An instance of NodeStepper to be used
        in this stepping session.
      restore_variable_values_on_exit: (bool) Whether any variables whose values
        have been altered during this node-stepper invocation should be restored
        to their old values when this invocation ends.

    Returns:
      The same return values as the `Session.run()` call on the same fetches as
        the NodeStepper.
    """ 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:18,代码来源:framework.py

示例5: _prepare_run_watch_config

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def _prepare_run_watch_config(self, fetches, feed_dict):
    """Get the debug_urls, and node/op whitelists for the current run() call.

    Args:
      fetches: Same as the `fetches` argument to `Session.run()`.
      feed_dict: Same as the `feed_dict argument` to `Session.run()`.

    Returns:
      debug_urls: (str or list of str) Debug URLs for the current run() call.
        Currently, the list consists of only one URL that is a file:// URL.
      watch_options: (WatchOptions) The return value of a watch_fn, containing
        options including debug_ops, and whitelists.
    """

    debug_urls = self.prepare_run_debug_urls(fetches, feed_dict)
    if self._watch_fn is None:
      watch_options = WatchOptions()
    else:
      watch_options = self._watch_fn(fetches, feed_dict)
      if isinstance(watch_options, tuple):
        # For legacy return type (tuples).
        watch_options = WatchOptions(*watch_options)

    return debug_urls, watch_options 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:26,代码来源:framework.py

示例6: run

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def run(args):
  """Function triggered by run command.

  Args:
    args: A namespace parsed from command line.

  Raises:
    AttributeError: An error when neither --inputs nor --input_exprs is passed
    to run command.
  """
  if not args.inputs and not args.input_exprs:
    raise AttributeError(
        'At least one of --inputs and --input_exprs must be required')
  tensor_key_feed_dict = load_inputs_from_input_arg_string(
      args.inputs, args.input_exprs)
  run_saved_model_with_feed_dict(args.dir, args.tag_set, args.signature_def,
                                 tensor_key_feed_dict, args.outdir,
                                 args.overwrite, tf_debug=args.tf_debug) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:20,代码来源:saved_model_cli.py

示例7: __init__

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def __init__(self, fetches, feed_dict, run_options, run_metadata,
               run_call_count):
    """Constructor of OnRunStartRequest.

    Args:
      fetches: Fetch targets of the run() call.
      feed_dict: The feed dictionary to the run() call.
      run_options: RunOptions input to the run() call.
      run_metadata: RunMetadata input to the run() call.
        The above four arguments are identical to the input arguments to the
        run() method of a non-wrapped TensorFlow session.
      run_call_count: 1-based count of how many run calls (including this one)
        has been invoked.
    """
    self.fetches = fetches
    self.feed_dict = feed_dict
    self.run_options = run_options
    self.run_metadata = run_metadata
    self.run_call_count = run_call_count 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:21,代码来源:framework.py

示例8: __init__

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def __init__(self, fetches, feed_dict, run_options, run_metadata,
               run_call_count, is_callable_runner=False):
    """Constructor of `OnRunStartRequest`.

    Args:
      fetches: Fetch targets of the run() call.
      feed_dict: The feed dictionary to the run() call.
      run_options: RunOptions input to the run() call.
      run_metadata: RunMetadata input to the run() call.
        The above four arguments are identical to the input arguments to the
        run() method of a non-wrapped TensorFlow session.
      run_call_count: 1-based count of how many run calls (including this one)
        has been invoked.
      is_callable_runner: (bool) whether a runner returned by
        Session.make_callable is being run.
    """
    self.fetches = fetches
    self.feed_dict = feed_dict
    self.run_options = run_options
    self.run_metadata = run_metadata
    self.run_call_count = run_call_count
    self.is_callable_runner = is_callable_runner 
开发者ID:PacktPublishing,项目名称:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代码行数:24,代码来源:framework.py

示例9: __enter__

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [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

示例10: prepare_run_debug_urls

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def prepare_run_debug_urls(self, fetches, feed_dict):
    """Abstract method to be implemented by concrete subclasses.

    This method prepares the run-specific debug URL(s).

    Args:
      fetches: Same as the `fetches` argument to `Session.run()`
      feed_dict: Same as the `feed_dict` argument to `Session.run()`

    Returns:
      debug_urls: (`str` or `list` of `str`) Debug URLs to be used in
        this `Session.run()` call.
    """ 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:15,代码来源:framework.py

示例11: _prepare_run_debug_urls

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def _prepare_run_debug_urls(self, fetches, feed_dict):
    """Abstract method to be implemented by concrete subclasses.

    This method prepares the run-specific debug URL(s).

    Args:
      fetches: Same as the `fetches` argument to `Session.run()`
      feed_dict: Same as the `feed_dict` argument to `Session.run()`

    Returns:
      debug_urls: (`str` or `list` of `str`) Debug URLs to be used in
        this `Session.run()` call.
    """ 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:15,代码来源:framework.py

示例12: _prepare_run_watch_config

# 需要导入模块: from tensorflow.python.client import session [as 别名]
# 或者: from tensorflow.python.client.session import run [as 别名]
def _prepare_run_watch_config(self, fetches, feed_dict):
    """Get the debug_urls, and node/op whitelists for the current run() call.

    Args:
      fetches: Same as the `fetches` argument to `Session.run()`.
      feed_dict: Same as the `feed_dict argument` to `Session.run()`.

    Returns:
      debug_urls: (str or list of str) Debug URLs for the current run() call.
        Currently, the list consists of only one URL that is a file:// URL.
      debug_ops: (str or list of str) Debug op(s) to be used by the
        debugger.
      node_name_regex_whitelist: (str or regex) Regular-expression whitelist for
        node name. Same as the same-name argument to debug_utils.watch_graph.
      op_type_regex_whitelist: (str or regex) Regular-expression whitelist for
        op type. Same as the same-name argument to debug_utils.watch_graph.
    """

    debug_urls = self._prepare_run_debug_urls(fetches, feed_dict)
    debug_ops = "DebugIdentity"
    node_name_regex_whitelist = None
    op_type_regex_whitelist = None
    if self._watch_fn is not None:
      debug_ops, node_name_regex_whitelist, op_type_regex_whitelist = (
          self._watch_fn(fetches, feed_dict))

    return (debug_urls, debug_ops, node_name_regex_whitelist,
            op_type_regex_whitelist) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:30,代码来源:framework.py


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