code: def get_eval_model(model):
      train_flag = model.training
      try:
          yield model.eval()
      finally:
          model.train(mode=train_flag)
  
file_path: coremltools/coremltools/optimize/torch/_utils/torch_utils.py
imports: import logging
  import operator
  import re
  from contextlib import contextmanager
  from typing import List
  from typing import Tuple
  from typing import Union
  import numpy
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: get_eval_model(model) without return types