TensoFlow实现条件语句
2024-08-25 17:00:58
import tensorflow as tf a = tf.constant(20) b = tf.constant(10) result1 = tf.cond(a > b, lambda: a, lambda: b) result2 = tf.cond(a < b, lambda: a, lambda: b) # Initialize all the variables (including parameters) randomly. init_op = tf.initialize_all_variables() sess = tf.InteractiveSession() # Run the init_op, evaluate the model outputs and print the results: sess.run(init_op) print sess.run(a) print sess.run(b) print "max value is: %d" % sess.run(result1) print "min value is: %d" % sess.run(result2)
20 10 max value is: 20 min value is: 10
最新文章
- jfinal和httl结合
- 百度地图API使用方法详解
- pptv破解版程序,能够免费观看所有蓝光和会员影片!
- 学习练习 java编写西游记人物类
- DOM 1
- Ruby中的Symbol与字符串
- Solaris 11的自动化安装(AI server)的搭建
- Gym 101257G 24 (概率+二分)
- bzoj 4826: [Hnoi2017]影魔 [主席树 单调栈]
- 【iOS 开发】iOS 开发 简介 (IOS项目文件 | MVC 模式 | 事件响应机制 | Storyboard 控制界面 | 代码控制界面 | Retina 屏幕图片适配)
- 计算机视觉学习记录 - Implementing a Neural Network from Scratch - An Introduction
- ArcGIS为面要素生成邻接矩阵
- keras神经网络做简单的回归问题
- leetcode每日刷题计划-简单篇day13
- ansible详解
- Spring-JDBC依赖
- pthreads v3下的worker和pool的使用
- Daily Scrum NO.1
- [Java123]Gradle
- CSS HTML 常用属性备忘录