We’ve opened an issue for this:
min/max require a huge allocation on GPU · Issue #63869 · pytorch/pytorch (github.com) 6
For now, if you don’t need to use the indices, a workaround would be to use amax rather than max here:
import torch
a = torch.rand(1000, 1000, 3, 256).cuda()
b = a.amax(dim=2)