piscis.networks.fpn
===================

.. py:module:: piscis.networks.fpn


Attributes
----------

.. autoapisummary::

   piscis.networks.fpn.ModuleDef
   piscis.networks.fpn.BatchActConv
   piscis.networks.fpn.BatchConv


Classes
-------

.. autoapisummary::

   piscis.networks.fpn.BatchConvStyle
   piscis.networks.fpn.UpConv
   piscis.networks.fpn.MakeStyle
   piscis.networks.fpn.Decoder
   piscis.networks.fpn.FPN


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

.. py:data:: ModuleDef

.. py:data:: BatchActConv

.. py:data:: BatchConv

.. py:class:: BatchConvStyle(in_channels: int, out_channels: int, style_channels: int, kernel_size: Union[int, Sequence[int]], conv: ModuleDef, dense: ModuleDef, bn: ModuleDef, act: ModuleDef)

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


   
   Convolutional block with batch norm, activation, and style transfer.


   :Parameters:

       **in_channels** : int
           Number of input channels.

       **out_channels** : int
           Number of output channels.

       **style_channels** : int
           Number of style channels.

       **kernel_size** : Union[int, Sequence[int]]
           Size of the convolutional kernel.

       **conv** : ModuleDef
           Convolution module.

       **dense** : ModuleDef
           Dense module.

       **bn** : ModuleDef
           Batch norm module.

       **act** : ModuleDef
           Activation function.














   ..
       !! processed by numpydoc !!

   .. py:attribute:: conv


   .. py:attribute:: dense


   .. py:method:: forward(style: Optional[torch.Tensor], x: torch.Tensor, y: Optional[torch.Tensor] = None) -> torch.Tensor


.. py:class:: UpConv(in_channels: int, out_channels: int, style_channels: int, kernel_size: Union[int, Sequence[int]], conv: ModuleDef, dense: ModuleDef, bn: ModuleDef, act: ModuleDef)

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


   
   Upsampling convolutional block.


   :Parameters:

       **in_channels** : int
           Number of input channels.

       **out_channels** : int
           Number of output channels.

       **style_channels** : int
           Number of style channels.

       **kernel_size** : Union[int, Sequence[int]]
           Size of the convolutional kernel.

       **conv** : ModuleDef
           Convolution module.

       **dense** : ModuleDef
           Dense module.

       **bn** : ModuleDef
           Batch norm module.

       **act** : ModuleDef
           Activation function.














   ..
       !! processed by numpydoc !!

   .. py:attribute:: proj


   .. py:attribute:: conv


   .. py:attribute:: convs_0


   .. py:attribute:: convs_1


   .. py:attribute:: convs_2


   .. py:method:: forward(x: torch.Tensor, y: Optional[torch.Tensor], style: Optional[torch.Tensor]) -> torch.Tensor


.. py:class:: MakeStyle(*args, **kwargs)

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


   
   Style transfer module.
















   ..
       !! processed by numpydoc !!

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor


.. py:class:: Decoder(stage_sizes: Sequence[int], kernel_size: Union[int, Sequence[int]], conv: ModuleDef, dense: ModuleDef, bn: ModuleDef, act: ModuleDef)

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


   
   Decoder module.


   :Parameters:

       **stage_sizes** : Sequence[int]
           Number of channels at each stage.

       **kernel_size** : Union[int, Sequence[int]]
           Size of the convolutional kernel.

       **conv** : ModuleDef
           Convolution module.

       **dense** : ModuleDef
           Dense module.

       **bn** : ModuleDef
           Batch norm module.

       **act** : ModuleDef
           Activation function.














   ..
       !! processed by numpydoc !!

   .. py:attribute:: stage_sizes


   .. py:attribute:: upsample


   .. py:attribute:: up_blocks


   .. py:attribute:: resize_up_blocks


   .. py:attribute:: out_channels


   .. py:method:: forward(style: torch.Tensor, xd: Sequence[torch.Tensor]) -> torch.Tensor


.. py:class:: FPN(encoder: ModuleDef, encoder_levels: Sequence[int], in_channels: int, out_channels: int, kernel_size: Union[int, Sequence[int]] = 3, style: bool = True, bn_momentum: float = 0.1, bn_epsilon: float = 1e-05, conv: ModuleDef = nn.Conv2d, dense: ModuleDef = nn.Linear, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU)

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


   
   Feature pyramid network.


   :Parameters:

       **encoder** : ModuleDef
           Encoder module.

       **encoder_levels** : Sequence[int]
           Encoder levels to use for the feature pyramid.

       **in_channels** : int
           Number of input channels.

       **out_channels** : int
           Number of output channels.

       **kernel_size** : Union[int, Sequence[int]], optional
           Size of the convolutional kernel. Default is s3.

       **style** : bool, optional
           Whether to use style transfer. Default is True.

       **bn_momentum** : float, optional
           Momentum parameter for batch norm layers. Default is 0.1.

       **bn_epsilon** : float, optional
           Epsilon parameter for batch norm layers. Default is 1e-5.

       **conv** : ModuleDef, optional
           Convolution module. Default is nn.Conv2d.

       **dense** : ModuleDef, optional
           Dense module. Default is nn.Linear.

       **bn** : ModuleDef, optional
           Batch norm module. Default is nn.BatchNorm2d.

       **act** : ModuleDef, optional
           Activation function. Default is nn.SiLU.














   ..
       !! processed by numpydoc !!

   .. py:attribute:: encoder


   .. py:attribute:: encoder_levels


   .. py:attribute:: style
      :value: True



   .. py:attribute:: decoder


   .. py:attribute:: output


   .. py:method:: forward(x: torch.Tensor) -> Tuple[torch.Tensor, Optional[torch.Tensor]]


