當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。