Say I have a tensor of size BxWxHxD. I want to process the tensor in such a way that I have a new tensor BxWxHxD, where only the maximum element in each fragment of WxH is stored, and all other values ββare zero.
In other words, I believe that the best way to achieve this is to somehow take 2D argmax through WxH slices, as a result of which the tensors of the BxD index for rows and columns can then be converted into a one-time tensor BxWxHxD to use as a mask. How to do it?
source share