If I reshape one_hot to (depth), the one_hot_matrix_test() is happy, but
new_y_test = y_test.map(one_hot_matrix)
is not, producing a long stack of grief followed by ValueError: Shape must be rank 1 but is rank 0 for ‘{{node Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](one_hot, Reshape/shape)’ with input shapes: [6], [].
If I reshape to (depth,1), now new_y_test = y_test.map(one_hot_matrix) is happy but one_hot_matrix_test() is not, because it expects tf.Tensor([0. 1. 0. 0.], shape=(4,), dtype=float32), (ie a one-dimensional vector vs. a single column matrix).
So I can either get 60% or 80% depending on which version I submit. Is the expected result of one_hot_matrix_test() just wrong?
It looks like it was expecting the shape to be a vector (rank 1) but found a scalar (rank 0) instead. Did you specify it as shape=scalar? If you did, try shape=(scalar,) instead.