code: def context(mmdet_config_dir: str) -> det_torch.PyTorchTrialContext:
      config_file = "./tests/fixtures/maskrcnn.yaml"
      with open(config_file, "rb") as f:
          config = util.safe_load_yaml_with_exceptions(f)
  
      core_context, env = det._make_local_execution_env(
          managed_training=False,
          test_mode=False,
          config=config,
          checkpoint_dir="/tmp",
          limit_gpus=1,
      )
  
      context = det_torch.PyTorchTrialContext(
          core_context=core_context,
          trial_seed=env.trial_seed,
          hparams=config["hyperparameters"],
          slots_per_trial=1,
          num_gpus=1,
          exp_conf=config,
          aggregation_frequency=1,
          steps_completed=0,
          managed_training=False,
          debug_enabled=False,
      )
      context._set_default_gradient_compression(False)
      context._set_default_average_aggregated_gradients(True)
  
      return context
  
imports: import os
  import shutil
  from typing import Generator
  import git
  import pytest
  import torch
  import determined
  import determined.pytorch
  import model_hub.mmdetection
  import model_hub.mmdetection._callbacks
  import model_hub.utils
  from determined.common import util
label_desc: Use image node_id 3 for calling a global function with example usage: context(mmdet_config_dir) and returns: context