Thanks for the reply @Ashish_Gupta1. That is indeed what is happening.
However, I want my network to give single float output and then calculate loss with respect to the target. How should I go about doing that? Do I have to use some other loss function ?