tensorflow-tf.group

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.51cto.com/13959448/2330992