函数: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

最新文章

  1. 浅谈压缩感知(二十五):压缩感知重构算法之分段正交匹配追踪(StOMP)
  2. Duilib中Webbrowser事件完善使其支持判断页面加载完毕
  3. Sprint第二个冲刺(第三天)
  4. html 元素添加 class
  5. 支持SMTP邮箱介绍
  6. ansible 检查大量客户端的文件与配置情况
  7. DS控件库 DS开放式下拉列表
  8. Dubbo 源码分析 - 自适应拓展原理
  9. 基于ARM9和嵌入式Linux系统的多功能综合通信控制系统的框架
  10. Nginx安装详细指南
  11. pandas 一行文本拆多行,一列拆多列
  12. spring boot之配置跨域
  13. 后台程序获取JPG/GIF/PNG图片宽度、高度
  14. springboot 集成 swagger
  15. HDU 5644 King&#39;s Pilots 费用流
  16. jquery获取textarea内容为空的问题
  17. Linux上安装Nginx及常用命令
  18. lintcode-124-最长连续序列
  19. 可伸缩Web架构与分布式系统(1)
  20. (八)JavaScript之[JSON]与[void]

热门文章

  1. WebLogic Server再曝高风险远程命令执行0day漏洞,阿里云WAF支持免费应急服务
  2. GitOps:Kubernetes多集群环境下的高效CICD实践
  3. Redis 5.0新功能介绍
  4. Laravel中利用队列发送邮件的方法示例
  5. PHP实现图片的等比缩放和Logo水印功能示例
  6. Chrome接口请求一直是pending状态,但接口实际上是正常的
  7. uni-app学习记录03-路由跳转
  8. CSS 个性化滚动条样式
  9. 怎样在RxJS Observable中使用Async-Await
  10. UVA 1343 - The Rotation Game-[IDA*迭代加深搜索]