import tensorflow as tf
import numpy as np
a =np.array([[[4,2],[3,4],[5,6]],[[2,1],[3,4],[4,5]]])
print(a.dtype)
print(a.shape)
结果:
2022-01-25 14:35:04.044154: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2022-01-25 14:35:04.044421: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
int32
(2, 3, 2)
Process finished with exit code 0
dtype 返回数据结构中数据元素的类型(int,float等),因此要求数据结构中包含的数据元素结构相同,故list, dict等不能调用dtype。
shape 返回元素的数据结构。