首页 > 解决方案 > 如何用python生成恒等张量?

问题描述

标签: pythonnumpytensorflowidentitytensor

解决方案


Instead of np.identity use tf.eye:

tf.eye(2)
# [[1., 0.],
#  [0., 1.]]

推荐阅读