code: def test_modify_pool(net, img_size):
      """Test ability to modify pooling module of network"""
  
      class AdaptiveMaxAvgPool(nn.Module):
          def __init__(self):
              super().__init__()
              self.ada_avgpool = nn.AdaptiveAvgPool2d(1)
              self.ada_maxpool = nn.AdaptiveMaxPool2d(1)
  
          def forward(self, x):
              avg_x = self.ada_avgpool(x)
              max_x = self.ada_maxpool(x)
              x = torch.cat((avg_x, max_x), dim=1)
              return x
  
      avg_pooling = AdaptiveMaxAvgPool()
      fc = nn.Linear(
          net._fc.in_features * 2, net._global_params.num_classes
      )
  
      net._avg_pooling = avg_pooling
      net._fc = fc
  
      data = torch.zeros((2, 3, img_size, img_size))
      output = net(data)
      assert not torch.isnan(output).any()
  
file_path: EfficientNet-PyTorch/tests/test_model.py
imports: from collections import OrderedDict
  import pytest
  import torch
  import torch.nn
  from efficientnet_pytorch import EfficientNet
label_desc: Use image node_id 9 for calling a global function with example usage: test_modify_pool(net, img_size) and returns: x