tensorflow keras utils to categorical

Solutions on MaxInterview for tensorflow keras utils to categorical by the best coders in the world

showing results for - "tensorflow keras utils to categorical"
Johanna
24 Apr 2017
1a = 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)