credit.trainers.trainerERA5gen1
===============================

.. py:module:: credit.trainers.trainerERA5gen1


Attributes
----------

.. autoapisummary::

   credit.trainers.trainerERA5gen1.logger
   credit.trainers.trainerERA5gen1.Trainer


Classes
-------

.. autoapisummary::

   credit.trainers.trainerERA5gen1.TrainerERA5Gen1


Module Contents
---------------

.. py:data:: logger

.. py:class:: TrainerERA5Gen1(model: torch.nn.Module, rank: int, conf: dict)

   Bases: :py:obj:`credit.trainers.base_trainer.BaseTrainer`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: flag_mass_conserve
      :value: False



   .. py:attribute:: flag_water_conserve
      :value: False



   .. py:attribute:: flag_energy_conserve
      :value: False



   .. py:attribute:: opt_mass
      :value: None



   .. py:attribute:: opt_water
      :value: None



   .. py:attribute:: opt_energy
      :value: None



   .. py:attribute:: varnum_diag


   .. py:attribute:: static_dim_size


   .. py:attribute:: retain_graph


   .. py:attribute:: forecast_len


   .. py:attribute:: valid_history_len


   .. py:attribute:: valid_forecast_len


   .. py:method:: train_one_epoch(epoch, trainloader, optimizer, criterion, scaler, scheduler, metrics)

      Train for one epoch.

      :param epoch: Current epoch number.
      :param conf: Full configuration dict (data keys accessed here for schema stability).
      :param trainloader: DataLoader for training.
      :param optimizer: Standard training objects.
      :param criterion: Standard training objects.
      :param scaler: Standard training objects.
      :param scheduler: Standard training objects.
      :param metrics: Standard training objects.

      :returns: Training metrics for the epoch.
      :rtype: dict



   .. py:method:: validate(epoch, valid_loader, criterion, metrics)

      Validate for one epoch.

      :param epoch: Current epoch number.
      :param conf: Full configuration dict.
      :param valid_loader: DataLoader for validation.
      :param criterion: Loss and metric callables.
      :param metrics: Loss and metric callables.

      :returns: Validation metrics for the epoch.
      :rtype: dict



.. py:data:: Trainer

