code: def check_loss_finite(val: float) -> None:
      if not np.isfinite(val):
          raise GluonTSDataError(
              "Encountered invalid loss value! Try reducing the learning rate "
              "or try a different likelihood."
          )
  
imports: import itertools
  import logging
  import os
  import tempfile
  import time
  import uuid
  import warnings
  from typing import cast, List, Optional, Union
  import mxnet
  import mxnet.autograd
  import mxnet.gluon.nn
  import numpy
  from mxnet.metric import ndarray
  from gluonts.core.component import validated
  from gluonts.dataset.loader import DataLoader
  from gluonts.exceptions import GluonTSDataError
  from gluonts.gluonts_tqdm import tqdm
  from gluonts.mx.context import get_mxnet_context
  from gluonts.mx.trainer.callback import Callback, CallbackList
  from gluonts.mx.util import HybridContext
  from .learning_rate_scheduler import LearningRateReduction
  from .model_averaging import SelectNBestMean, save_epoch_info, ModelAveraging
label_desc: Use image node_id 1 for calling a global function with example usage: check_loss_finite(val) without return types