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


Python summary.histogram方法代码示例

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


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

示例1: add_gradients_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_gradients_summaries(grads_and_vars):
  """Add summaries to gradients.

  Args:
    grads_and_vars: A list of gradient to variable pairs (tuples).

  Returns:
    The list of created summaries.
  """
  summaries = []
  for grad, var in grads_and_vars:
    if grad is not None:
      if isinstance(grad, ops.IndexedSlices):
        grad_values = grad.values
      else:
        grad_values = grad
      summaries.append(
          summary.histogram(var.op.name + '/gradient', grad_values))
      summaries.append(
          summary.scalar(var.op.name + '/gradient_norm',
                         clip_ops.global_norm([grad_values])))
    else:
      logging.info('Var %s has no gradient', var.op.name)

  return summaries 
开发者ID:yuantailing,项目名称:ctw-baseline,代码行数:27,代码来源:learning.py

示例2: _add_scalar_summary

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def _add_scalar_summary(tensor, tag=None):
  """Add a scalar summary operation for the tensor.

  Args:
    tensor: The tensor to summarize.
    tag: The tag to use, if None then use tensor's op's name.

  Returns:
    The created histogram summary.

  Raises:
    ValueError: If the tag is already in use or the rank is not 0.
  """
  tensor.get_shape().assert_has_rank(0)
  tag = tag or '%s_summary' % tensor.op.name
  return summary.scalar(tag, tensor) 
开发者ID:taehoonlee,项目名称:tensornets,代码行数:18,代码来源:summaries.py

示例3: add_gradients_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_gradients_summaries(grads_and_vars):
  """Add summaries to gradients.

  Args:
    grads_and_vars: A list of gradient to variable pairs (tuples).

  Returns:
    The list of created summaries.
  """
  summaries = []
  for grad, var in grads_and_vars:
    if grad is not None:
      if isinstance(grad, ops.IndexedSlices):
        grad_values = grad.values
      else:
        grad_values = grad
      summaries.append(
          summary.histogram(var.op.name + '_gradient', grad_values))
      summaries.append(
          summary.scalar(var.op.name + '_gradient_norm',
                         clip_ops.global_norm([grad_values])))
    else:
      logging.info('Var %s has no gradient', var.op.name)

  return summaries 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:27,代码来源:training.py

示例4: add_gradients_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_gradients_summaries(grads_and_vars):
  """Add summaries to gradients.

  Args:
    grads_and_vars: A list of gradient to variable pairs (tuples).

  Returns:
    The list of created summaries.
  """
  summaries = []
  for grad, var in grads_and_vars:
    if grad is not None:
      if isinstance(grad, ops.IndexedSlices):
        grad_values = grad.values
      else:
        grad_values = grad
      summaries.append(
          summary.histogram(var.op.name + '/gradient', grad_values))
      summaries.append(
          summary.histogram(var.op.name + '/gradient_norm',
                            clip_ops.global_norm([grad_values])))
    else:
      logging.info('Var %s has no gradient', var.op.name)

  return summaries 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:27,代码来源:learning.py

示例5: add_gradients_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_gradients_summaries(grads_and_vars):
  """Add summaries to gradients.

  Args:
    grads_and_vars: A list of gradient to variable pairs (tuples).

  Returns:
    The list of created summaries.
  """
  summaries = []
  for grad, var in grads_and_vars:
    if grad is not None:
      if isinstance(grad, ops.IndexedSlices):
        grad_values = grad.values
      else:
        grad_values = grad
      summaries.append(
          summary.histogram(var.op.name + '_gradient', grad_values))
      summaries.append(
          summary.histogram(var.op.name + '_gradient_norm',
                            clip_ops.global_norm([grad_values])))
    else:
      logging.info('Var %s has no gradient', var.op.name)

  return summaries 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:27,代码来源:training.py

示例6: add_gradients_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_gradients_summaries(grads_and_vars):
  """Add summaries to gradients.
  Args:
    grads_and_vars: A list of gradient to variable pairs (tuples).
  Returns:
    The list of created summaries.
  """
  summaries = []
  for grad, var in grads_and_vars:
    if grad is not None:
      if isinstance(grad, ops.IndexedSlices):
        grad_values = grad.values
      else:
        grad_values = grad
      summaries.append(
          summary.histogram(var.op.name + '/gradient', grad_values))
      summaries.append(
          summary.scalar(var.op.name + '/gradient_norm',
                         clip_ops.global_norm([grad_values])))
    else:
      logging.info('Var %s has no gradient', var.op.name)

  return summaries 
开发者ID:autoai-org,项目名称:CVTron,代码行数:25,代码来源:learning.py

示例7: add_gradients_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_gradients_summaries(grads_and_vars):
  """Add summaries to gradients.

  Args:
    grads_and_vars: A list of gradient to variable pairs (tuples).

  Returns:
    The list of created summaries.
  """
  summaries = []
  for grad, var in grads_and_vars:
    if grad is not None:
      if isinstance(grad, ops.IndexedSlices):
        grad_values = grad.values
      else:
        grad_values = grad
      summaries.append(
          summary.histogram(var.op.name + '/gradient', grad_values))
      summaries.append(
          summary.scalar(var.op.name + '/gradient_norm',
                         clip_ops.global_norm([grad_values])))
    else:
      log.warn('Var %s has no gradient', var.op.name)

  return summaries 
开发者ID:wonheeML,项目名称:mtl-ssl,代码行数:27,代码来源:learning.py

示例8: _add_histogram_summary

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def _add_histogram_summary(tensor, tag=None):
  """Add a summary operation for the histogram of a tensor.

  Args:
    tensor: The tensor to summarize.
    tag: The tag to use, if None then use tensor's op's name.

  Returns:
    The created histogram summary.

  Raises:
    ValueError: If the tag is already in use.
  """
  tag = tag or '%s_summary' % tensor.op.name
  return summary.histogram(tag, tensor) 
开发者ID:taehoonlee,项目名称:tensornets,代码行数:17,代码来源:summaries.py

示例9: summarize_tensor

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def summarize_tensor(tensor, tag=None):
  """Summarize a tensor using a suitable summary type.

  This function adds a summary op for `tensor`. The type of summary depends on
  the shape of `tensor`. For scalars, a `scalar_summary` is created, for all
  other tensors, `histogram_summary` is used.

  Args:
    tensor: The tensor to summarize
    tag: The tag to use, if None then use tensor's op's name.

  Returns:
    The summary op created or None for string tensors.
  """
  # Skips string tensors and boolean tensors (not handled by the summaries).
  if (tensor.dtype.is_compatible_with(dtypes.string) or
      tensor.dtype.base_dtype == dtypes.bool):
    return None

  if tensor.get_shape().ndims == 0:
    # For scalars, use a scalar summary.
    return _add_scalar_summary(tensor, tag)
  else:
    # We may land in here if the rank is still unknown. The histogram won't
    # hurt if this ends up being a scalar.
    return _add_histogram_summary(tensor, tag) 
开发者ID:taehoonlee,项目名称:tensornets,代码行数:28,代码来源:summaries.py

示例10: _add_hidden_layer_summary

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def _add_hidden_layer_summary(self, value, tag):
    # TODO(zakaria): Move this code to tf.learn and add test.
    summary.scalar("%s/fraction_of_zero_values" % tag, nn.zero_fraction(value))
    summary.histogram("%s/activation" % tag, value) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:6,代码来源:composable_model.py

示例11: _add_hidden_layer_summary

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def _add_hidden_layer_summary(value, tag):
  summary.scalar("%s_fraction_of_zero_values" % tag, nn.zero_fraction(value))
  summary.histogram("%s_activation" % tag, value) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:dnn.py

示例12: _add_hidden_layer_summary

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def _add_hidden_layer_summary(value, tag):
  summary.scalar("%s/fraction_of_zero_values" % tag, nn.zero_fraction(value))
  summary.histogram("%s/activation" % tag, value) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:dnn_linear_combined.py

示例13: add_histogram_summary

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_histogram_summary(tensor, name=None, prefix=None):
  """Adds a histogram summary for the given tensor.

  Args:
    tensor: A variable or op tensor.
    name: The optional name for the summary.
    prefix: An optional prefix for the summary names.

  Returns:
    A scalar `Tensor` of type `string` whose contents are the serialized
    `Summary` protocol buffer.
  """
  return summary.histogram(
      _get_summary_name(tensor, name, prefix), tensor) 
开发者ID:google-research,项目名称:tf-slim,代码行数:16,代码来源:summaries.py

示例14: add_histogram_summaries

# 需要导入模块: from tensorflow.python.summary import summary [as 别名]
# 或者: from tensorflow.python.summary.summary import histogram [as 别名]
def add_histogram_summaries(tensors, prefix=None):
  """Adds a histogram summary for each of the given tensors.

  Args:
    tensors: A list of variable or op tensors.
    prefix: An optional prefix for the summary names.

  Returns:
    A list of scalar `Tensors` of type `string` whose contents are the
    serialized `Summary` protocol buffer.
  """
  summary_ops = []
  for tensor in tensors:
    summary_ops.append(add_histogram_summary(tensor, prefix=prefix))
  return summary_ops 
开发者ID:google-research,项目名称:tf-slim,代码行数:17,代码来源:summaries.py


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