code: def test_report_model_train_state(optimizer, inplace):
      model = torch.nn.Sequential(
          torch.nn.Conv2d(1, 31, 2, 1), torch.nn.Conv2d(31, 21, 2, 1)
      )
  
      opt = optimizer(model)
      if optimizer == LinearQuantizer:
          p_model = opt.prepare(
              inplace=inplace, example_inputs=torch.randn(1)
          )
      else:
          p_model = opt.prepare(inplace=inplace)
  
      p_model.train()
      opt.report()
      assert p_model.training
  
      p_model.eval()
      opt.report()
      assert not p_model.training
  
imports: import pytest
  import torch
  from coremltools.optimize.torch.palettization import DKMPalettizer
  from coremltools.optimize.torch.pruning import MagnitudePruner
  from coremltools.optimize.torch.quantization import LinearQuantizer
label_desc: Use image node_id 1 for calling a global function with example usage: test_report_model_train_state(optimizer, inplace) without return types