I have an input of numbers, ranging on [0, 15], which I want to feed to my network as a binary code with 4 bits. For example, the input [0,1,4,7] should become [[0,0,0,0],[0,0,0,1],[0,1,0,0],[0,1,1,1]].
The tf.one_hot operation is close, but not exactly what I want. Is there any elegant way, either with Numpy or TensorFlow, to convert my input into its binary encoding, in order to feed it into my network?
My best solution was to use np.binary_repr for each value, and convert it from a string into an array of integers, but I feel this is not a good solution (converting twice, first into string, then into array).