code: def validate_pytorch_model(
      platform,
      model_file,
      input_file,
      mace_out_file,
      input_names,
      input_shapes,
      input_data_formats,
      output_names,
      output_shapes,
      output_data_formats,
      validation_threshold,
      input_data_types,
      log_file,
  ):
      import torch
  
      loaded_model = torch.jit.load(model_file)
      pytorch_inputs = []
      for i in range(len(input_names)):
          input_value = load_data(
              util.formatted_file_name(input_file, input_names[i]),
              input_data_types[i],
          )
          input_value = input_value.reshape(input_shapes[i])
          if (
              input_data_formats[i] == DataFormat.NHWC
              and len(input_shapes[i]) == 4
          ):
              input_value = input_value.transpose((0, 3, 1, 2))
          input_value = torch.from_numpy(input_value)
          pytorch_inputs.append(input_value)
      with torch.no_grad():
          pytorch_outputs = loaded_model(*pytorch_inputs)
  
      if isinstance(pytorch_outputs, torch.Tensor):
          pytorch_outputs = [pytorch_outputs]
      else:
          if not isinstance(pytorch_outputs, (list, tuple)):
              print(
                  "return type {} unsupported".format(
                      type(pytorch_outputs)
                  )
              )
              sys.exit(1)
      for i in range(len(output_names)):
          value = pytorch_outputs[i].numpy()
          output_file_name = util.formatted_file_name(
              mace_out_file, output_names[i]
          )
          mace_out_value = load_data(output_file_name)
          (
              mace_out_value,
              real_output_shape,
              real_output_data_format,
          ) = get_real_out_value_shape_df(
              platform,
              mace_out_value,
              output_shapes[i],
              output_data_formats[i],
          )
          compare_output(
              output_names[i],
              mace_out_value,
              value,
              validation_threshold,
              log_file,
              real_output_shape,
              real_output_data_format,
          )
  
imports: import os
  import sys
  import os.path
  import numpy
  import six
  from py_proto import mace_pb2
  from utils import util
  from utils.config_parser import DataFormat
  from utils.config_parser import Platform
  from utils.util import mace_check
label_desc: Use image node_id 11 for calling a global function with example usage: validate_pytorch_model(platform, model_file, input_file, mace_out_file, input_names, input_shapes, input_data_formats, output_names, output_shapes, output_data_formats, validation_threshold, input_data_types, log_file) without return types