piscis.networks.conv
====================

.. py:module:: piscis.networks.conv


Attributes
----------

.. autoapisummary::

   piscis.networks.conv.ModuleDef
   piscis.networks.conv.ConvBatchAct


Classes
-------

.. autoapisummary::

   piscis.networks.conv.Conv
   piscis.networks.conv.SqueezeExcite
   piscis.networks.conv.MBConv
   piscis.networks.conv.FusedMBConv


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

.. py:data:: ModuleDef

.. py:class:: Conv(in_channels: int, out_channels: int, kernel_size: Union[int, Sequence[int]] = 3, stride: Union[int, Sequence[int]] = 1, padding: Optional[Union[int, Sequence[int], str]] = None, dilation: Union[int, Sequence[int]] = 1, groups: int = 1, bias: Optional[bool] = None, padding_mode: str = 'zeros', conv: ModuleDef = nn.Conv2d, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU, layers: Sequence[str] = ('conv', 'bn', 'act'))

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


   
   Convolutional block with batch norm and activation.


   :Parameters:

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

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

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

       **stride** : Union[int, Sequence[int]]
           Stride of the convolution. Default is 1.

       **padding** : Optional[Union[int, Sequence[int], str]], optional
           Padding of the convolution. Default is None.

       **dilation** : Union[int, Sequence[int]], optional
           Dilation of the convolution. Default is 1.

       **groups** : int, optional
           Number of groups of the convolution. Default is 1.

       **bias** : Optional[bool], optional
           Whether to use bias in the convolution. Default is None.

       **padding_mode** : str, optional
           Padding mode of the convolution. Default is 'zeros'.

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

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

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

       **layers** : Sequence[str], optional
           Sequence of layers to apply. Default is ('conv', 'bn', 'act').














   ..
       !! processed by numpydoc !!

   .. py:attribute:: conv


   .. py:method:: forward(x)


.. py:data:: ConvBatchAct

.. py:class:: SqueezeExcite(in_channels: int, squeeze_channels: int, conv: ModuleDef = nn.Conv2d, act: ModuleDef = nn.SiLU)

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


   
   Squeeze and excite block.


   :Parameters:

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

       **squeeze_channels** : int
           Number of squeeze channels.

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

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














   ..
       !! processed by numpydoc !!

   .. py:attribute:: reduce


   .. py:attribute:: act


   .. py:attribute:: expand


   .. py:attribute:: sigmoid


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


.. py:class:: MBConv(in_channels: int, out_channels: int, expand_ratio: int, kernel_size: Union[int, Sequence[int]], stride: int, se_ratio: float, stochastic_depth_prob: float, conv: ModuleDef = nn.Conv2d, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU)

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


   
   Mobile inverted bottleneck convolutional block.


   :Parameters:

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

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

       **expand_ratio** : int
           Expansion ratio.

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

       **stride** : int
           Stride of the convolution.

       **se_ratio** : float
           Squeeze and excitation ratio.

       **stochastic_depth_prob** : float
           Stochastic depth probability.

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

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

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














   ..
       !! processed by numpydoc !!

   .. py:attribute:: block


   .. py:attribute:: use_res_connect


   .. py:attribute:: stochastic_depth


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


.. py:class:: FusedMBConv(in_channels: int, out_channels: int, expand_ratio: int, kernel_size: Union[int, Sequence[int]], stride: int, se_ratio: float, stochastic_depth_prob: float, conv: ModuleDef = nn.Conv2d, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU)

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


   
   Fused mobile inverted bottleneck convolutional block.


   :Parameters:

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

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

       **expand_ratio** : int
           Expansion ratio.

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

       **stride** : int
           Stride of the convolution.

       **se_ratio** : float
           Squeeze and excitation ratio.

       **stochastic_depth_prob** : float
           Stochastic depth probability.

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

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

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














   ..
       !! processed by numpydoc !!

   .. py:attribute:: block


   .. py:attribute:: use_res_connect


   .. py:attribute:: stochastic_depth


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


