tensorflow

安装

pip install tensorflow

错误

ERROR: Could not find a version that satisfies the requirement cachetools<5.0,>=2.0.0 (from google-auth<2,>=1.6.3->tensorboard~=2.6->tensorflow) (from versions: none)
ERROR: No matching distribution found for cachetools<5.0,>=2.0.0 (from google-auth<2,>=1.6.3->tensorboard~=2.6->tensorflow)

解决 - 先升级grpcio

pip install --upgrade grpcio

第一个程序

import tensorflow as tf

A = tf.constant([[1, 2], [3, 4]])
B = tf.constant([[5, 6], [7, 8]])
C = tf.matmul(A, B)

print(C)

输出

tf.Tensor(
[[19 22]
 [43 50]], shape=(2, 2), dtype=int32)

入门数学劝退

高等数学

最后更新于