code: def test_pm_imagenet(model_name, pretrained):
      if set_grad_enabled:
          set_grad_enabled(False)
  
      print('test_pm_imagenet("{}")'.format(model_name))
      net = pm.__dict__[model_name](
          num_classes=1000, pretrained=pretrained
      )
      net.eval()
  
      tensor = utils.TransformImage(net)(img)
      tensor = tensor.unsqueeze(0)
      x = Variable(tensor, requires_grad=False)
  
      out_logits = net(x)
      if "squeezenet" in model_name:
          # Conv2d without view at the end
          assert out_logits.shape == torch.Size([1, 1000, 1, 1])
          return
  
      assert out_logits.shape == torch.Size([1, 1000])
  
      out_feats = net.features(x)
      out_logits_2 = net.logits(out_feats)
      assert equal(out_logits, out_logits_2)
  
      if "dpn" in model_name:
          # Conv2d instead of Linear
          return
      net.last_linear = nn.Linear(net.last_linear.in_features, 10)
  
      out_logits_3 = net.logits(out_feats)
      assert out_logits_3.shape == torch.Size([1, 10])
  
      if set_grad_enabled:
          set_grad_enabled(True)
  
imports: import pytest
  import torch
  import torch.nn
  from torch.autograd import Variable
  import pretrainedmodels
  import pretrainedmodels.utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_pm_imagenet(model_name, pretrained) without return types