python输出数组、列表、元组、张量形状的方法

输出数组形状

链接: link.

a=np.array([[1,2,3],[4,5,6]],dtype=np.float)
print(a.shape);

输出列表形状

a=[1,2,3]
a=np.array(a)
print(a.shape);

输出元组形状

a=('a','b','c')
a=list(a)
print(a.shape);

输出张量形状

d=tf.constant([[1,2,3],[4,5,6]])
print(d)

输出张量值

d=tf.constant([[1,2,3],[4,5,6]])
with tf.Session() as sess:
    print(d.eval())  

猜你喜欢

转载自blog.csdn.net/ddana_a/article/details/107492423