Skip to content

Base modules

BaseDetectionModule

Bases: nn.Module, ABC

An interface for a module that is easy to integrate into a model with complex connections

Source code in src/super_gradients/modules/base_modules.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class BaseDetectionModule(nn.Module, ABC):
    """
    An interface for a module that is easy to integrate into a model with complex connections
    """

    def __init__(self, in_channels: Union[List[int], int], **kwargs):
        """
        :param in_channels: defines channels of tensor(s) that will be accepted by a module in forward
        """
        super().__init__()
        self.in_channels = in_channels

    @property
    @abstractmethod
    def out_channels(self) -> Union[List[int], int]:
        """
        :return: channels of tensor(s) that will be returned by a module  in forward
        """
        raise NotImplementedError()

out_channels: Union[List[int], int] abstractmethod property

Returns:

Type Description

channels of tensor(s) that will be returned by a module in forward

__init__(in_channels, **kwargs)

Parameters:

Name Type Description Default
in_channels Union[List[int], int]

defines channels of tensor(s) that will be accepted by a module in forward

required
Source code in src/super_gradients/modules/base_modules.py
14
15
16
17
18
19
def __init__(self, in_channels: Union[List[int], int], **kwargs):
    """
    :param in_channels: defines channels of tensor(s) that will be accepted by a module in forward
    """
    super().__init__()
    self.in_channels = in_channels