credit.preblock.base
====================

.. py:module:: credit.preblock.base


Classes
-------

.. autoapisummary::

   credit.preblock.base.BasePreblock


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

.. py:class:: BasePreblock(*args: Any, **kwargs: Any)

   Bases: :py:obj:`torch.nn.Module`


   Base class for all preblocks. Enforces the forward signature and
   provides the from_config classmethod used by the registry.


   .. py:attribute:: VALID_DATA_TYPES
      :value: ('input', 'target')



   .. py:method:: _copy_batch(batch: dict) -> dict

      Shallow-copy the batch so forward() never mutates the caller's dict.

      Creates new dict objects at the data_type and source levels; tensor
      values are shared (not copied) since preblocks must not mutate tensors
      in-place anyway (doing so would break autograd).



   .. py:method:: forward(batch: dict) -> dict


   .. py:method:: from_config(**kwargs)
      :classmethod:



