tf.reduce_mean函数用法及有趣区别
2024-09-01 11:20:55
sess=tf.Session() a=np.array([1,2,3,5.]) # 此代码保留为浮点数 a1=np.array([1,2,3,5]) # 此代码保留为整数
c=tf.reduce_mean(a)
d=sess.run(c)
print(a)
print(d)
c1=tf.reduce_mean(a1)
d1=sess.run(c1)
print(a1)
print(d1)
总结:tf.reduce_mean(a,axis)是均值,其中a是输入矩阵,axis是从什么维度求均值。然而,代码运行发现,a为浮点数,返回为浮点数,a为整数,返回为向下取的整数。
最新文章
- 【Prince2是什么】PRINCE2认证之Prince2衡量绩效的六大要素
- 深入理解定位父级offsetParent及偏移大小
- Html定位精要
- 阿里云部署Java web项目初体验(转)/linux 上配置jdk和安装tomcat
- JavaScript类型判断
- PAC学习框架
- Android ViewPager刷新解析
- 小结JS中的OOP(中)
- 0_Simple__simpleAssert + 0_Simple__simpleAssert_nvrtc
- 程序猿必知必会Linux命令之awk
- seed实验——Set-UID Program Vulnerability实验
- 通过DFS求解有向图(邻接表存储)中所有简单回路
- Spring 拦截器postHandle无法修改Response的原因
- 【Zookeeper系列】ZooKeeper伸缩性(转)
- [LeetCode&;Python] Problem 748. Shortest Completing Word
- 【Python】exe2shellcode,shellcode2exe
- spring boot 多数据源分布式事务处理
- SVG基础图形和D3.js
- P4427 [BJOI2018]求和
- Python 出现错误 SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform.
热门文章
- jvm(三)指令重排 &; 内存屏障 &; 可见性 &; volatile &; happen before
- bitcoinjs-lib 哈希交易之多笔交易合并。
- Oracle的“ORA-00937: 不是单组分组函数” 如何解决?
- kafka window环境下使用(内置zookeeper)
- c++ Array运用实例
- 在idea中打开maven项目pom.xml未识别
- webuploader超时时间timeout设置
- Flask自动刷新前端页面(方便调试)livereload
- 简单工厂(二)——coding
- 深入Nginx之《常用参数配置技巧》