fork download
import tensorflow as tf
import numpy as np
 
a = np.zeros((4,2))
b = tf.random.categorical(a, 1)
x = b
y = tf.one_hot(x, depth=2)
print(tf.shape(y))
Success #stdin #stdout 1.05s 197896KB
stdin
Standard input is empty
stdout
Tensor("Shape:0", shape=(3,), dtype=int32)