Maximum of a map in a 4 dimensional variable

Hello Everyone,

I was trying to find the maximum of a map in 4-dimensional Variable.

the Variable size is [B,C,H,W]. and I want to find the maximum of the each [H,W] map.

so my output should be something of a size. [B,C].

Thanks

Would x.max(3).max(2) work?

Thank you for your reply @ptrblck I tried it and got the following error:

‘tuple’ object has no attribute ‘max’

Oh, you are right, sorry! max() returns a tuple with the max values and its corresponding indices.
You could try this instead:

x.max(3)[0].max(2)[0]

Would this work for you?

Thanks, @ptrblck, beautifully working :slight_smile: :slight_smile: