TensorFlow之tf.less()
2024-08-31 10:31:28
函数:tf.less
less( x, y, name=None )
以元素方式返回(x <y)的真值.
注意:Less支持广播.
参数:
- x:张量.必须是下列类型之一:float32,float64,int32,int64,uint8,int16,int8,uint16,half.
- y:张量.必须与 x 具有相同的类型.
- name:操作的名称(可选).
返回值:
该函数返回 bool 类型的张量.
举例:
import tensorflow as tf
A=[[1,2,3]]
t = tf.shape(A)
i=[3,2]
r = tf.less(i, t)
with tf.Session() as sess:
print(sess.run(t))
print(sess.run(r))
结果:
[1 3]
[False True]
import tensorflow as tf
A=[[1,2,3],
[4,5,6]]
t = tf.shape(A)
i=[[1,2,3],
[1,2,3]]
r = tf.less(i, A)
with tf.Session() as sess:
print(sess.run(t))
print(sess.run(r))
结果:
[2 3]
[[False False False]
[ True True True]]
参考文献:https://www.w3cschool.cn/tensorflow_python/tensorflow_python-fw182f4x.html
https://blog.csdn.net/stt12345678/article/details/83987675
最新文章
- 浅谈压缩感知(二十五):压缩感知重构算法之分段正交匹配追踪(StOMP)
- Duilib中Webbrowser事件完善使其支持判断页面加载完毕
- Sprint第二个冲刺(第三天)
- html 元素添加 class
- 支持SMTP邮箱介绍
- ansible 检查大量客户端的文件与配置情况
- DS控件库 DS开放式下拉列表
- Dubbo 源码分析 - 自适应拓展原理
- 基于ARM9和嵌入式Linux系统的多功能综合通信控制系统的框架
- Nginx安装详细指南
- pandas 一行文本拆多行,一列拆多列
- spring boot之配置跨域
- 后台程序获取JPG/GIF/PNG图片宽度、高度
- springboot 集成 swagger
- HDU 5644 King&#39;s Pilots 费用流
- jquery获取textarea内容为空的问题
- Linux上安装Nginx及常用命令
- lintcode-124-最长连续序列
- 可伸缩Web架构与分布式系统(1)
- (八)JavaScript之[JSON]与[void]
热门文章
- WebLogic Server再曝高风险远程命令执行0day漏洞,阿里云WAF支持免费应急服务
- GitOps:Kubernetes多集群环境下的高效CICD实践
- Redis 5.0新功能介绍
- Laravel中利用队列发送邮件的方法示例
- PHP实现图片的等比缩放和Logo水印功能示例
- Chrome接口请求一直是pending状态,但接口实际上是正常的
- uni-app学习记录03-路由跳转
- CSS 个性化滚动条样式
- 怎样在RxJS Observable中使用Async-Await
- UVA 1343 - The Rotation Game-[IDA*迭代加深搜索]