yes I’m having that warning and I thought of this answer but I wanted to show the different output of the two functions using my case.
In the second function it should work, why in case of 1 channel it gives ones everywhere ? I don’t have three channels, I only have this as output (P,1,s,s) where I want to perform softmax on the one channel I have as feature map.  P is my batch-size and s is image dimension