code: def test_pass_frozen_trial_to_torch_distributed(
      storage_mode: str,
  ) -> None:
      # Regression test of #4697
      def objective(trial: optuna.trial.BaseTrial) -> float:
          trial = optuna.integration.TorchDistributedTrial(
              trial if dist.get_rank() == 0 else None
          )
          x = trial.suggest_float("x", low=-100, high=100)
          return x * x
  
      with StorageSupplier(storage_mode) as storage:
          study = optuna.create_study(
              direction="minimize", storage=storage
          )
          study.optimize(objective, n_trials=1)
          best_trial = study.best_trial
  
          objective(best_trial)
  
imports: import datetime
  import os
  from typing import Optional
  import pytest
  import optuna
  from optuna._imports import try_import
  from optuna.integration import TorchDistributedTrial
  from optuna.testing.pruners import DeterministicPruner
  from optuna.testing.storages import StorageSupplier
label_desc: Use image node_id 20 for calling a global function with example usage: test_pass_frozen_trial_to_torch_distributed(storage_mode) and returns: unknown