code: def batch_transform(monkeypatch, train_env):
      monkeypatch.setenv("SAGEMAKER_BATCH", "true")
  
      inference_config = {
          "context_length": context_length,
          "prediction_length": prediction_length,
          "num_samples": num_samples,
          "output_types": ["mean", "samples"],
          "quantiles": [],
          **train_env.hyperparameters,
      }
  
      monkeypatch.setenv(
          "INFERENCE_CONFIG", json.dumps(inference_config)
      )
      monkeypatch.setenv("GLUONTS_FORWARD_FIELDS", json.dumps(["foo"]))
      return inference_config
  
imports: import json
  import logging
  import sys
  from typing import ContextManager
  import numpy
  import pytest
  from gluonts.core.component import equals
  from gluonts.dataset.jsonl import encode_json
  from gluonts.model.trivial.mean import MeanPredictor
  from gluonts.shell.env import ServeEnv, TrainEnv
  from gluonts.shell.train import run_train_and_test
label_desc: Use image node_id 4 for calling a global function with example usage: batch_transform(monkeypatch, train_env) and returns: inference_config