I am struggling with a problem in which I need to convert my tensor such that out of total values, the maximum value gets 1 as a value and rest as 0.
tf.Tensor(
[[0.05]
[0.1]
[0.5]
[0.35]],shape=(4,1),dtype = float32)
I tried
out = tf.sparse_to_dense(tf.argmax(a),tf.cast(tf.shape(a), dtype=tf.int64), tf.reduce_max(a))
but unfortunately, getting an error as
Input must be a SparseTensor.
I wanted the output as
tf.Tensor(
[[0]
[0]
[1]
[0]],shape=(4,1),dtype = float32)
please help me to solve the problem. Thanks a lot