deep_learning_Function_tensorflow_unpack()

tf.unpack(A, axis)是一个解包函数。A是一个需要被解包的对象,axis是一个解包方式的定义,默认是零,如果是零,返回的结果就是按行解包。如果是1,就是按列解包。

例如:

from tensorflow.models.rnn.ptb import reader
import tensorflow as tf;
import numpy as np;
 
A = [[1, 2, 3], [4, 2, 3]]
B = tf.unpack(A, axis=1)
 
with tf.Session() as sess:
    print sess.run(B)

 输出:
[array([1, 4], dtype=int32), array([2, 2], dtype=int32), array([3, 3], dtype=int32)]
————————————————
原文链接:https://blog.csdn.net/UESTC_C2_403/article/details/72808556

猜你喜欢

转载自www.cnblogs.com/0405mxh/p/11643704.html