code: def test_torch_e2e(ray_start_4_cpus, prepare_model):
      def train_func():
          model = torch.nn.Linear(3, 1)
          if prepare_model:
              model = train.torch.prepare_model(model)
          train.report({}, checkpoint=TorchCheckpoint.from_model(model))
  
      scaling_config = ScalingConfig(num_workers=2)
      trainer = TorchTrainer(
          train_loop_per_worker=train_func,
          scaling_config=scaling_config,
      )
      trainer.fit()
  
imports: import contextlib
  import os
  import tempfile
  import time
  import uuid
  from unittest.mock import patch
  import pytest
  import torch
  import ray
  import ray.train
  from ray.cluster_utils import Cluster
  from ray.train import Checkpoint, RunConfig, ScalingConfig
  from ray.train.examples.pytorch.torch_linear_example import train_func
  from ray.train.torch import TorchCheckpoint, TorchConfig, TorchPredictor, TorchTrainer
  from ray.train.trainer import TrainingFailedError
label_desc: Use image node_id 4 for calling a global function with example usage: test_torch_e2e(ray_start_4_cpus, prepare_model) without return types