code: def test_torch_linear(ray_start_4_cpus, num_workers):
      def train_func(config):
          result = linear_train_func(config)
          assert len(result) == epochs
          assert result[-1]["loss"] < result[0]["loss"]
  
      num_workers = num_workers
      epochs = 3
      scaling_config = ScalingConfig(num_workers=num_workers)
      config = {
          "lr": 1e-2,
          "hidden_size": 1,
          "batch_size": 4,
          "epochs": epochs,
      }
      trainer = TorchTrainer(
          train_loop_per_worker=train_func,
          train_loop_config=config,
          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 3 for calling a global function with example usage: test_torch_linear(ray_start_4_cpus, num_workers) without return types