codecamp

TensorFlow函数:tf.reduce_any

tf.reduce_any 函数
reduce_any(
    input_tensor,
    axis=None,
    keep_dims=False,
    name=None,
    reduction_indices=None
)

定义在:tensorflow/python/ops/math_ops.py.

请参阅指南:数学函数>减少

在张量的维度上计算元素的 "逻辑或".

按照axis给定的维度减少input_tensor.除非 keep_dims 是 true,否则张量的秩将在axis的每个条目中减少1.如果keep_dims为true,则缩小的维度将保留为1.

如果axis没有条目,则会减少所有维度,并返回具有单个元素的张量.

例如:

x = tf.constant([[True,  True], [False, False]])
tf.reduce_any(x)  # True
tf.reduce_any(x, 0)  # [True, True]
tf.reduce_any(x, 1)  # [True, False]

参数:

  • input_tensor:要减少的布尔张量.
  • axis:要减小的尺寸.如果为None(默认),则减少所有维度.必须在范围[-rank(input_tensor), rank(input_tensor))内.
  • keep_dims:如果为true,则保留长度为1的缩小维度.
  • name:操作的名称(可选).
  • reduction_indices:axis的已经弃用的名称.

返回:

减少张量.

numpy兼容性:

相当于np.any

tf.reduce_all函数:计算张量在维度上的逻辑和
tf.reduce_join函数:添加字符串张量
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }