RegNet

class torch_ecg.models.RegNet(in_channels: int, **config)[source]

Bases: Sequential, SizeMixin, CitationMixin

RegNet model.

RegNet is a family of convolutional neural networks that can be constructed by efficiently scaling and pruning a single convolutional “stem” network. This architecture is proposed in [1], and the implementation is adapted from [2].

References

Parameters:
  • in_channels (int) – Number of channels of the input.

  • config (dict) –

    Hyper-parameters of the Module, ref. corr. config file. Keyword arguments that must be set:

    • filter_lengths: int or sequence of int, filter length(s) (kernel size(s)) of the convolutions, with granularity to the whole network, to each stage.

    • subsample_lengths: int or sequence of int, subsampling length(s) (ratio(s)) of all blocks, with granularity to the whole network, to each stage.

    • tot_blocks: int, the total number of building blocks.

    • w_a, w_0, w_m: float, the parameters for the widths generating function.

    • group_widths: int or sequence of int, the number of channels in each group, with granularity to the whole network, to each stage.

    • num_blocks: sequence of int, optional, the number of blocks in each stage, if not given, will be computed from tot_blocks and w_a, w_0, w_m.

    • num_filters: int or sequence of int, optional, the number of filters in each stage. If not given, will be computed from tot_blocks and w_a, w_0, w_m.

    • stem: dict, the config of the input stem.

    • block: dict, other parameters that can be set for the building blocks.

compute_output_shape(seq_len: int | None = None, batch_size: int | None = None) Sequence[int | None][source]

Compute the output shape of the network.

Parameters:
  • seq_len (int, optional) – Length of the input tensors.

  • batch_size (int, optional) – Batch size of the input tensors.

Returns:

output_shape – The output shape of the module.

Return type:

sequence