Skip to content

Instantly share code, notes, and snippets.

@infinityfuture
Last active October 3, 2018 16:47
Show Gist options
  • Save infinityfuture/ea37d68fd3476c55a0b7b92d747d9e7b to your computer and use it in GitHub Desktop.
Save infinityfuture/ea37d68fd3476c55a0b7b92d747d9e7b to your computer and use it in GitHub Desktop.
Pytorch Global Max Pooling
def global_max_pooling(tensor, dim, topk):
"""Global max pooling"""
ret, _ = torch.topk(tensor, topk, dim)
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment