📅  最后修改于: 2022-03-11 14:47:03.541000             🧑  作者: Mango
a = tf.keras.utils.to_categorical([0, 1, 2, 3], num_classes=4)a = tf.constant(a, shape=[4, 4])print(a)tf.Tensor( [[1. 0. 0. 0.] [0. 1. 0. 0.] [0. 0. 1. 0.] [0. 0. 0. 1.]], shape=(4, 4), dtype=float32)