class_docstr: Implement Non-monotonically Triggered AvSGD (NTA).
  This method is based on paper "Regularizing and Optimizing LSTM Language
  Models", (https://openreview.net/pdf?id=SyyGPP0TZ), and an implementation
  is available in Salesforce GitHub
  (https://github.com/salesforce/awd-lstm-lm/blob/master/main.py). Note that
  it mismatches the arxiv (and gluonnlp) version, which is referred to as
  NTA_V2 below.
docstr: Parameters
  ----------
  metric
      The criteria to trigger averaging.
  epoch
      The epoch to start averaging, not used in NTA
  
  Returns
  -------
docstr_tok: ["Parameters","--","--","--","--","--","metric","The","criteria","to","trigger","averaging",".","epoch","The","epoch","to","start","averaging",",","not","used","in","NTA","Returns","--","--","--","-"]
code: def update_average_trigger(
      self, metric: Any = None, epoch: int = 0, **kwargs
  ):
      r"""
      Parameters
      ----------
      metric
          The criteria to trigger averaging.
      epoch
          The epoch to start averaging, not used in NTA
  
      Returns
      -------
      """
  
      # If not triggered already due to epoch loss check fallback condition
      if not self.averaging_started:
          if epoch >= self.fallback_alpha_suffix:
              self.averaging_started = True
  
      if not self.averaging_started and self.n > 0:
          min_len = self.n if self.last_n_trigger else (self.n + 1)
          sliced_val_logs = (
              self.val_logs[-self.n :]
              if self.last_n_trigger
              else self.val_logs[: -self.n]
          )
          if self.maximize:
              if len(self.val_logs) >= min_len and metric < max(
                  sliced_val_logs
              ):
                  self.averaging_started = True
          else:
              if len(self.val_logs) >= min_len and metric > min(
                  sliced_val_logs
              ):
                  self.averaging_started = True
          self.val_logs.append(metric)
  
imports: from typing import Any, Dict, List, Optional
  import logging
  import mxnet
  import mxnet.gluon.nn
  from mxnet import gluon
  from gluonts.core.component import validated
  from .callback import Callback
label_desc: Use image node_id 2 for calling the NTA obj's underlying member method code with example usage: obj.update_average_trigger(metric, epoch) without return types