tensorflow随笔-条件循环控制(3)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010255642/article/details/82289961

tf.group

 

tf.group(
    *inputs,
    **kwargs
)

创建一个操作,组合多操作。

当该操作完成后,在inputs的所有操作完成,该操作没有输出。

参数:

  • *inputs: 需要组合的零或多个tensors
  • name: 操作符的名字(可选)

返回:

一个操作符,能处理所有输入

Raises:

ValueError: 如果提供了unknown关键参数。

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 11:16:32 2018
@author: myhaspl
"""
 
import tensorflow as tf
x1 = tf.random_normal([3,5000],mean=100)
x2 = tf.random_normal([3,5000],mean=100)
x3 = tf.random_normal([3,5000],mean=100)

y1 = tf.sqrt(x1)
y2 = tf.sqrt(x2)
y3 = tf.sqrt(x3)
z = tf.group([y1,y2,y3])


sess=tf.Session()
with sess: 
    sess.run(z)

猜你喜欢

转载自blog.csdn.net/u010255642/article/details/82289961
今日推荐