tf.math.reduce_mean(input_tensor, axis=None, keepdims=False, name=None
)

对tf.reduce_mean的理解就是求平均值,reduce指的是一串数据求平均值后维数降低了,可不是吗,一串向量变成了一个数,维数自然降低了

API URL

https://tensorflow.google.cn/api_docs/python/tf/math/reduce_mean?hl=en

Used in the notebooks

tf.math.reduce_mean(input_tensor, axis=None, keepdims=False, name=None
)

Used in the notebooks

Used in the guide Used in the tutorials
  • Training checkpoints
  • Writing custom layers and models with Keras
  • Ragged tensors
  • Eager execution
  • Better performance with tf.function and AutoGraph
  • CycleGAN
  • Neural style transfer
  • Custom training: basics
  • Convolutional Variational Autoencoder
  • DeepDream

Reduces input_tensor along the dimensions given in axis. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keepdims is true, the reduced dimensions are retained with length 1.

If axis is None, all dimensions are reduced, and a tensor with a single element is returned.

For example:

x = tf.constant([[1., 1.], [2., 2.]])
tf.reduce_mean(x)  # 1.5
tf.reduce_mean(x, 0)  # [1.5, 1.5]
tf.reduce_mean(x, 1)  # [1.,  2.]

Args:

  • input_tensor: The tensor to reduce. Should have numeric type.
  • axis: The dimensions to reduce. If None (the default), reduces all dimensions. Must be in the range [-rank(input_tensor), rank(input_tensor)).
  • keepdims: If true, retains reduced dimensions with length 1.
  • name: A name for the operation (optional).

Returns:

The reduced tensor.

Numpy Compatibility

Equivalent to np.mean

Please note that np.mean has a dtype parameter that could be used to specify the output type. By default this is dtype=float64. On the other hand, tf.reduce_mean has an aggressive type inference from input_tensor, for example:

x = tf.constant([1, 0, 1, 0])
tf.reduce_mean(x)  # 0
y = tf.constant([1., 0., 1., 0.])
tf.reduce_mean(y)  # 0.5
 
   

Reduces input_tensor along the dimensions given in axis

对tf.reduce_mean API的理解就是求平均值,reduce指的是一串数据求平均值后维数降低了,可不是吗,一串向量变成了一个数,维数自然降低了相关推荐

  1. c语言在一组数据中找最大值最小值,用c语言输入一组数据,输出最大最小值,求c语言程序讲解: 输入一组数据,求最大值,最小值,和,平均...

    问题标题 用c语言输入一组数据,输出最大最小值,求c语言程序讲解: 输入一组数据,求最大值,最小值,和,平均 2019-7-3来自ip:18.156.193.207的网友咨询 浏览量:318 手机版 ...

  2. tensorflow的tf.reduce_mean函数

    tf.reduce_mean函数的作用是求平均值.第一个参数是一个集合,可以是列表.二维数组和多维数组.第二个参数指定在哪个维度上面求平均值.默认对所有的元素求平均.tf.reduce_mean 比如 ...

  3. tf.reduce_mean()

    版权声明:本文为博主原创文章,欢迎大家交流    https://blog.csdn.net/he_min/article/details/78694383 在tensorflow中经常见到reduc ...

  4. tensorflow学习之常用函数总结:tensorflow官方例子中的诸如tf.reduce_mean()这类函数

    前言 tensorflow官网给的例子用到了很多函数,然后并没有具体说明,还要自己去翻文档,有些函数是很常用的,下面来一一总结. 正文 一,tensorflow中有一类在tensor的某一维度上求值的 ...

  5. C语言试题三十四之求除1到m之内(含m)能北7或11整除的所有整数放在数组a中,通过n返回这些数的个数。

    1. 题目 请编写一个函数function,它的功能是:求除1到m之内(含m)能北7或11整除的所有整数放在数组a中,通过n返回这些数的个数. 2 .温馨提示 C语言试题汇总里可用于计算机二级C语言笔 ...

  6. tf.reduce_mean

    tf.reduce_mean(x) ==> 2.5 #如果不指定第二个参数,那么就在所有的元素中取平均值 tf.reduce_mean(x, 0) ==> [2., 3.] #指定第二个参 ...

  7. tf.estimator API技术手册(16)——自定义Estimator

    tf.estimator API技术手册(16)--自定义Estimator (一)前 言 (二)自定义estimator的一般步骤 (三)准备训练数据 (四)自定义estimator实践 (1)创建 ...

  8. 对tf.nn.softmax的理解

    Softmax的含义:Softmax简单的说就是把一个N*1的向量归一化为(0,1)之间的值,由于其中采用指数运算,使得向量中数值较大的量特征更加明显. 如图所示,在等号左边部分就是全连接层做的事. ...

  9. tensorflow reduce系列函数(tf.reduce_mean, tf.reduce_sum, tf.reduce_prod, tf.reduce_max, tf.reduce_min)

    简而言之,reduce系列的函数都可在张量指定的维度上操作 目录 输入参数 tf.reduce_all   在boolean张量的维度上计算元素的 "逻辑和" tf.reduce_ ...

最新文章

  1. 解决数据库读写分离(转)
  2. 屏蔽微软的SignalR
  3. Unity初步 基本拼图实现
  4. 文本信息检索基本知识【转】
  5. Python 3.x标准模块库目录
  6. 四层交换机是什么?有什么用?与二层/三层交换机有何区别?
  7. RabbitMQ封装实战
  8. 深入Spring:自定义注解加载和使用
  9. iphone闪退修复工具_iPhone更新iOS 13出现程序闪退?大家不妨试试这个方法来解决问题...
  10. strutr2运行流程
  11. batch spring 重复执行_spring-batch – Spring批处理:重新启动作业,然后自动启动下一个作业...
  12. eclipse、MyEclipse实现批量改动文件编码
  13. excel首行空不能导入access_EXCEL数据无法导入ACCESS的解决办法
  14. java替换图片_Java 替换 PPT 中的图片
  15. html 锚文本,什么是锚文本,锚文本链接对SEO的影响!
  16. react-native弹性布局
  17. 这家5G边缘计算企业科创板首发过会!
  18. 学习机器人无从下手?带你体会当下机器人热门研究方向有哪些
  19. 说说twitter(一)
  20. 汉标断筋大圆字体发布

热门文章

  1. angularjs和mysql_AngularJS SQL
  2. python电子时钟包装盒_python 电子时钟
  3. linux限制显卡频率,关于安装Linux (FC6)频率超出范围与显卡驱动
  4. 教程:9、网络通信工具
  5. python 灰度图像_python库skimage 给灰度图像染色
  6. java反序列化weblogic_[Todo]Java反序列化-weblogic
  7. java 句子拆分_java – 将段落拆分为单个句子.我在这里覆盖了所有的基地吗?
  8. 【c语言】蓝桥杯基础练习 01字串
  9. 20.Feature分支
  10. linux基础(8)-颜色显示