code: def test_pytorch(
      time,
      name_from_base,
      sagemaker_session,
      pytorch_inference_version,
      pytorch_inference_py_version,
      gpu_pytorch_instance_type,
  ):
      pytorch = PyTorch(
          entry_point=SCRIPT_PATH,
          role=ROLE,
          sagemaker_session=sagemaker_session,
          instance_count=INSTANCE_COUNT,
          instance_type=INSTANCE_TYPE,
          framework_version=pytorch_inference_version,
          py_version=pytorch_inference_py_version,
          enable_sagemaker_metrics=False,
      )
  
      inputs = "s3://mybucket/train"
  
      pytorch.fit(inputs=inputs, experiment_config=EXPERIMENT_CONFIG)
  
      sagemaker_call_names = [
          c[0] for c in sagemaker_session.method_calls
      ]
      assert sagemaker_call_names == ["train", "logs_for_job"]
      boto_call_names = [
          c[0] for c in sagemaker_session.boto_session.method_calls
      ]
      assert boto_call_names == ["resource"]
  
      expected_train_args = _create_train_job(
          pytorch_inference_version, pytorch_inference_py_version
      )
      expected_train_args["input_config"][0]["DataSource"][
          "S3DataSource"
      ]["S3Uri"] = inputs
      expected_train_args["experiment_config"] = EXPERIMENT_CONFIG
      expected_train_args["enable_sagemaker_metrics"] = False
  
      actual_train_args = sagemaker_session.method_calls[0][2]
      assert actual_train_args == expected_train_args
  
      model = pytorch.create_model()
  
      expected_image_uri = image_uris.retrieve(
          "pytorch",
          REGION,
          version=pytorch_inference_version,
          py_version=pytorch_inference_py_version,
          instance_type=gpu_pytorch_instance_type,
          image_scope="inference",
      )
  
      actual_environment = model.prepare_container_def(
          gpu_pytorch_instance_type
      )
      submit_directory = actual_environment["Environment"][
          "SAGEMAKER_SUBMIT_DIRECTORY"
      ]
      model_url = actual_environment["ModelDataUrl"]
      expected_environment = _get_environment(
          submit_directory, model_url, expected_image_uri
      )
      assert actual_environment == expected_environment
  
      assert "cpu" in model.prepare_container_def(CPU)["Image"]
      predictor = pytorch.deploy(1, gpu_pytorch_instance_type)
      assert isinstance(predictor, PyTorchPredictor)
  
imports: from __future__ import absolute_import
  import logging
  import json
  import os
  import pytest
  from mock import ANY, MagicMock, Mock, patch
  from packaging.version import Version
  from sagemaker import image_uris
  from sagemaker.pytorch import defaults
  from sagemaker.pytorch import PyTorch, PyTorchPredictor, PyTorchModel
  from sagemaker.instance_group import InstanceGroup
  from sagemaker.session_settings import SessionSettings
label_desc: Use image node_id 10 for calling a global function with example usage: test_pytorch(time, name_from_base, sagemaker_session, pytorch_inference_version, pytorch_inference_py_version, gpu_pytorch_instance_type) without return types