code: def test_kmax_pool():
      x = torch.randn((8, 512, 16, 16))
      module1 = GlobalKMaxPool2d(k=4, flatten=True)
      module2 = GlobalKMaxPool2d(k=4, flatten=False)
  
      y1 = module1(x)
      y2 = module2(x)
  
      assert y1.size() == (8, 512)
      assert y2.size() == (8, 512, 1, 1)
  
imports: import pytest
  import torch
  from pytorch_toolbelt.modules import HFF, ResidualDeconvolutionUpsample2d, GlobalKMaxPool2d
label_desc: Use image node_id 4 for calling a global function with example usage: test_kmax_pool() without return types