添加:tf.enable_eager_execution(),開啓即時模式
A = tf.constant([[1., 2.], [3., 4.]])
B = tf.constant([[5., 6.], [7., 8.]])
tf.enable_eager_execution()
print(A.shape) # 輸出(2, 2),即矩陣的長和寬均爲2
print(A.dtype) # 輸出<dtype: 'float32'>
print(A.numpy()) # 輸出[[1. 2.]
# [3. 4.]]