获取一个tensor类型变量的shape
import tensorflow
as tf
import numpy
a
=tf
.random
.normal
([4,28,28,3])
print(type(a
))
print(a
.shape
)
print(a
[1].shape
)
print(a
[1,2].shape
)
print(a
[1,2,3].shape
)
print(a
[1,2,1,1].shape
)
之前报错是因为我把shape写成了shape(),感觉在入门深度学习的路上又像我当初入门C语言的时候,犯很低级的错误,哭辽 报错信息如下:
print(a
.shape
())
TypeError
: 'TensorShape' object is not callable
转载请注明原文地址:https://blackberry.8miu.com/read-1388.html