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


Python math_ops._ReductionDims方法代码示例

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


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

示例1: sparse_reduce_sum_sparse

# 需要导入模块: from tensorflow.python.ops import math_ops [as 别名]
# 或者: from tensorflow.python.ops.math_ops import _ReductionDims [as 别名]
def sparse_reduce_sum_sparse(sp_input, axis=None, keep_dims=False,
                             reduction_axes=None):
  """Computes the sum of elements across dimensions of a SparseTensor.

  This Op takes a SparseTensor and is the sparse counterpart to
  `tf.reduce_sum()`.  In contrast to SparseReduceSum, this Op returns a
  SparseTensor.

  Reduces `sp_input` along the dimensions given in `reduction_axes`.  Unless
  `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in
  `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained
  with length 1.

  If `reduction_axes` has no entries, all dimensions are reduced, and a tensor
  with a single element is returned.  Additionally, the axes can be negative,
  which are interpreted according to the indexing rules in Python.

  Args:
    sp_input: The SparseTensor to reduce. Should have numeric type.
    axis: The dimensions to reduce; list or scalar. If `None` (the
      default), reduces all dimensions.
    keep_dims: If true, retain reduced dimensions with length 1.
    reduction_axes: Deprecated name of axis

  Returns:
    The reduced SparseTensor.
  """
  output_ind, output_val, output_shape = (
      gen_sparse_ops.sparse_reduce_sum_sparse(
          sp_input.indices, sp_input.values,
          sp_input.dense_shape, math_ops._ReductionDims(sp_input, axis,
                                                        reduction_axes),
          keep_dims))

  return sparse_tensor.SparseTensor(output_ind, output_val, output_shape) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:37,代码来源:sparse_ops.py

示例2: sparse_reduce_sum_sparse

# 需要导入模块: from tensorflow.python.ops import math_ops [as 别名]
# 或者: from tensorflow.python.ops.math_ops import _ReductionDims [as 别名]
def sparse_reduce_sum_sparse(sp_input, reduction_axes=None, keep_dims=False):
  """Computes the sum of elements across dimensions of a SparseTensor.

  This Op takes a SparseTensor and is the sparse counterpart to
  `tf.reduce_sum()`.  In contrast to SparseReduceSum, this Op returns a
  SparseTensor.

  Reduces `sp_input` along the dimensions given in `reduction_axes`.  Unless
  `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in
  `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained
  with length 1.

  If `reduction_axes` has no entries, all dimensions are reduced, and a tensor
  with a single element is returned.  Additionally, the axes can be negative,
  which are interpreted according to the indexing rules in Python.

  Args:
    sp_input: The SparseTensor to reduce. Should have numeric type.
    reduction_axes: The dimensions to reduce; list or scalar. If `None` (the
      default), reduces all dimensions.
    keep_dims: If true, retain reduced dimensions with length 1.

  Returns:
    The reduced SparseTensor.
  """
  output_ind, output_val, output_shape = (
      gen_sparse_ops.sparse_reduce_sum_sparse(
          sp_input.indices, sp_input.values,
          sp_input.shape, math_ops._ReductionDims(sp_input, reduction_axes),
          keep_dims))

  return sparse_tensor.SparseTensor(output_ind, output_val, output_shape) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:34,代码来源:sparse_ops.py

示例3: sparse_reduce_max_sparse

# 需要导入模块: from tensorflow.python.ops import math_ops [as 别名]
# 或者: from tensorflow.python.ops.math_ops import _ReductionDims [as 别名]
def sparse_reduce_max_sparse(sp_input, axis=None, keep_dims=False,
                             reduction_axes=None):
  """Computes the max of elements across dimensions of a SparseTensor.

  This Op takes a SparseTensor and is the sparse counterpart to
  `tf.reduce_max()`.  In contrast to SparseReduceSum, this Op returns a
  SparseTensor.

  Reduces `sp_input` along the dimensions given in `reduction_axes`.  Unless
  `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in
  `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained
  with length 1.

  If `reduction_axes` has no entries, all dimensions are reduced, and a tensor
  with a single element is returned.  Additionally, the axes can be negative,
  which are interpreted according to the indexing rules in Python.

  Args:
    sp_input: The SparseTensor to reduce. Should have numeric type.
    axis: The dimensions to reduce; list or scalar. If `None` (the
      default), reduces all dimensions.
    keep_dims: If true, retain reduced dimensions with length 1.
    reduction_axes: Deprecated name of axis

  Returns:
    The reduced SparseTensor.
  """
  output_ind, output_val, output_shape = (
      gen_sparse_ops.sparse_reduce_max_sparse(
          sp_input.indices, sp_input.values,
          sp_input.dense_shape, math_ops._ReductionDims(sp_input, axis,
                                                        reduction_axes),
          keep_dims))

  return sparse_tensor.SparseTensor(output_ind, output_val, output_shape) 
开发者ID:PacktPublishing,项目名称:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代码行数:37,代码来源:sparse_ops.py

示例4: sparse_reduce_sum

# 需要导入模块: from tensorflow.python.ops import math_ops [as 别名]
# 或者: from tensorflow.python.ops.math_ops import _ReductionDims [as 别名]
def sparse_reduce_sum(sp_input, axis=None, keep_dims=False,
                      reduction_axes=None):
  """Computes the sum of elements across dimensions of a SparseTensor.

  This Op takes a SparseTensor and is the sparse counterpart to
  `tf.reduce_sum()`.  In particular, this Op also returns a dense `Tensor`
  instead of a sparse one.

  Reduces `sp_input` along the dimensions given in `reduction_axes`.  Unless
  `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in
  `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained
  with length 1.

  If `reduction_axes` has no entries, all dimensions are reduced, and a tensor
  with a single element is returned.  Additionally, the axes can be negative,
  similar to the indexing rules in Python.

  For example:

  ```python
  # 'x' represents [[1, ?, 1]
  #                 [?, 1, ?]]
  # where ? is implicitly-zero.
  tf.sparse_reduce_sum(x) ==> 3
  tf.sparse_reduce_sum(x, 0) ==> [1, 1, 1]
  tf.sparse_reduce_sum(x, 1) ==> [2, 1]  # Can also use -1 as the axis.
  tf.sparse_reduce_sum(x, 1, keep_dims=True) ==> [[2], [1]]
  tf.sparse_reduce_sum(x, [0, 1]) ==> 3
  ```

  Args:
    sp_input: The SparseTensor to reduce. Should have numeric type.
    axis: The dimensions to reduce; list or scalar. If `None` (the
      default), reduces all dimensions.
    keep_dims: If true, retain reduced dimensions with length 1.
    reduction_axes: Deprecated name of axis.

  Returns:
    The reduced Tensor.
  """
  return gen_sparse_ops.sparse_reduce_sum(
      sp_input.indices, sp_input.values,
      sp_input.dense_shape,
      math_ops._ReductionDims(sp_input, axis, reduction_axes),
      keep_dims) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:47,代码来源:sparse_ops.py

示例5: sparse_reduce_sum

# 需要导入模块: from tensorflow.python.ops import math_ops [as 别名]
# 或者: from tensorflow.python.ops.math_ops import _ReductionDims [as 别名]
def sparse_reduce_sum(sp_input, reduction_axes=None, keep_dims=False):
  """Computes the sum of elements across dimensions of a SparseTensor.

  This Op takes a SparseTensor and is the sparse counterpart to
  `tf.reduce_sum()`.  In particular, this Op also returns a dense `Tensor`
  instead of a sparse one.

  Reduces `sp_input` along the dimensions given in `reduction_axes`.  Unless
  `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in
  `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained
  with length 1.

  If `reduction_axes` has no entries, all dimensions are reduced, and a tensor
  with a single element is returned.  Additionally, the axes can be negative,
  similar to the indexing rules in Python.

  For example:

  ```python
  # 'x' represents [[1, ?, 1]
  #                 [?, 1, ?]]
  # where ? is implicitly-zero.
  tf.sparse_reduce_sum(x) ==> 3
  tf.sparse_reduce_sum(x, 0) ==> [1, 1, 1]
  tf.sparse_reduce_sum(x, 1) ==> [2, 1]  # Can also use -1 as the axis.
  tf.sparse_reduce_sum(x, 1, keep_dims=True) ==> [[2], [1]]
  tf.sparse_reduce_sum(x, [0, 1]) ==> 3
  ```

  Args:
    sp_input: The SparseTensor to reduce. Should have numeric type.
    reduction_axes: The dimensions to reduce; list or scalar. If `None` (the
      default), reduces all dimensions.
    keep_dims: If true, retain reduced dimensions with length 1.

  Returns:
    The reduced Tensor.
  """
  return gen_sparse_ops.sparse_reduce_sum(
      sp_input.indices, sp_input.values,
      sp_input.shape, math_ops._ReductionDims(sp_input, reduction_axes),
      keep_dims) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:44,代码来源:sparse_ops.py

示例6: sparse_reduce_max

# 需要导入模块: from tensorflow.python.ops import math_ops [as 别名]
# 或者: from tensorflow.python.ops.math_ops import _ReductionDims [as 别名]
def sparse_reduce_max(sp_input, axis=None, keep_dims=False,
                      reduction_axes=None):
  """Computes the max of elements across dimensions of a SparseTensor.

  This Op takes a SparseTensor and is the sparse counterpart to
  `tf.reduce_max()`.  In particular, this Op also returns a dense `Tensor`
  instead of a sparse one.

  Reduces `sp_input` along the dimensions given in `reduction_axes`.  Unless
  `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in
  `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained
  with length 1.

  If `reduction_axes` has no entries, all dimensions are reduced, and a tensor
  with a single element is returned.  Additionally, the axes can be negative,
  similar to the indexing rules in Python.

  For example:

  ```python
  # 'x' represents [[1, ?, 2]
  #                 [?, 3, ?]]
  # where ? is implicitly-zero.
  tf.sparse_reduce_max(x) ==> 3
  tf.sparse_reduce_max(x, 0) ==> [1, 3, 2]
  tf.sparse_reduce_max(x, 1) ==> [2, 3]  # Can also use -1 as the axis.
  tf.sparse_reduce_max(x, 1, keep_dims=True) ==> [[2], [3]]
  tf.sparse_reduce_max(x, [0, 1]) ==> 3
  ```

  Args:
    sp_input: The SparseTensor to reduce. Should have numeric type.
    axis: The dimensions to reduce; list or scalar. If `None` (the
      default), reduces all dimensions.
    keep_dims: If true, retain reduced dimensions with length 1.
    reduction_axes: Deprecated name of axis.

  Returns:
    The reduced Tensor.
  """
  return gen_sparse_ops.sparse_reduce_max(
      sp_input.indices, sp_input.values,
      sp_input.dense_shape,
      math_ops._ReductionDims(sp_input, axis, reduction_axes),
      keep_dims) 
开发者ID:PacktPublishing,项目名称:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代码行数:47,代码来源:sparse_ops.py


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