tensorflow API:tf.group
来源:互联网 发布:手机壳推荐 知乎 编辑:程序博客网 时间:2024/06/06 04:31
tf.group
group( *inputs, **kwargs)
创建一个包含几个操作的op结点
当这个op结点运行完成,所有作为input的ops都被运行完成,这个操作没有返回值
例子:
tag =tf.reduce_any([True])b = tf.Variable(tf.random_normal([5,3],stddev=0.35),name="weights") #init = tf.initialize_all_variables()sess = tf.Session()#sess.run(init)print(sess.run(b.initialized_value()))with tf.control_dependencies([tag]): do_updates = tf.group( tf.reduce_sum(input_tensor=b), b.assign(b+10) )init = tf.initialize_all_variables()sess.run(init)sess.run([do_updates])print(sess.run(tag))print(sess.run(b))
结果:
[[-0.06633449 0.83556134 0.14434727]
[-0.3425082 -0.39835241 0.51608163]
[ 0.21805006 -0.02585059 -0.04273668]
[-0.18699114 0.01443172 0.10423679]
[-0.62762541 -0.14095569 0.34139016]]
True
[[ 10.06451797 10.65713215 10.08987713]
[ 10.30089855 10.40508556 10.25630856]
[ 9.92398548 9.75419617 9.68528366]
[ 10.20005417 10.23743248 10.3180685 ]
[ 10.57752132 10.41219616 9.6665287 ]]
阅读全文
0 0
- tensorflow API:tf.group
- tensorflow tf.group
- tensorflow API:tf.truncated_normal
- tensorflow API:tf.set_random_seed
- tensorflow API:tf.split
- tensorflow API:tf.tile
- tensorflow API:tf.slice
- tensorflow API: tf.unsorted_segment_sum
- tensorflow API:tf.control_dependencies
- tensorflow API:tf.reduce_sum
- tensorflow API:tf.not_equal
- tensorflow API:tf.argmin
- tensorflow API: tf.unsorted_segment_sum
- tensorflow API: tf.concat
- tensorflow API:tf.Variable
- Tensorflow API 学习(1)-tf.concat()
- Tensorflow API 学习(3)-tf.slice()
- Tensorflow API——tf.random_normal_initializer
- python<win10下使用定时任务执行程序>
- Windows桌面应用程序(1-2-1st) Windows编程简介在C++中
- QT 开发工具简介
- js面向对象——工厂模式(超级基础)
- 当你使用Flask框架时,必须要知道的操作!
- tensorflow API:tf.group
- QT 自定义信号和槽
- ESR:程序语言设计的要诣和真谛
- 你或许不知道的实用 GNOME Shell 快捷键
- java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.con
- 【每日安全资讯】新安卓病毒Loapi爆发:绑架你的手机来挖矿
- zigbee内部宏分析
- iOS开发—使用TYAttributedLabel实现字体大小颜色各异并且带链接的文本
- Unity中Git使用指南