MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / SkipConnectionConvModule

Class SkipConnectionConvModule

numpy_ml/neural_nets/modules/modules.py:615–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

613
614
615class SkipConnectionConvModule(ModuleBase):
616 def __init__(
617 self,
618 out_ch1,
619 out_ch2,
620 kernel_shape1,
621 kernel_shape2,
622 kernel_shape_skip,
623 pad1=0,
624 pad2=0,
625 stride1=1,
626 stride2=1,
627 act_fn=None,
628 epsilon=1e-5,
629 momentum=0.9,
630 stride_skip=1,
631 optimizer=None,
632 init="glorot_uniform",
633 ):
634 """
635 A ResNet-like "convolution" shortcut module.
636
637 Notes
638 -----
639 In contrast to :class:`SkipConnectionIdentityModule`, the additional
640 `conv2d_skip` and `batchnorm_skip` layers in the shortcut path allow
641 adjusting the dimensions of `X` to match the output of the main set of
642 convolutions.
643
644 .. code-block:: text
645
646 X -> Conv2D -> Act_fn -> BatchNorm2D -> Conv2D -> BatchNorm2D -> + -> Act_fn
647 \_____________________ Conv2D -> Batchnorm2D __________________/
648
649 References
650 ----------
651 .. [1] He et al. (2015). "Deep residual learning for image
652 recognition." https://arxiv.org/pdf/1512.03385.pdf
653
654 Parameters
655 ----------
656 out_ch1 : int
657 The number of filters/kernels to compute in the first convolutional
658 layer.
659 out_ch2 : int
660 The number of filters/kernels to compute in the second
661 convolutional layer.
662 kernel_shape1 : 2-tuple
663 The dimension of a single 2D filter/kernel in the first
664 convolutional layer.
665 kernel_shape2 : 2-tuple
666 The dimension of a single 2D filter/kernel in the second
667 convolutional layer.
668 kernel_shape_skip : 2-tuple
669 The dimension of a single 2D filter/kernel in the "skip"
670 convolutional layer.
671 stride1 : int
672 The stride/hop of the convolution kernels in the first

Callers 1

Calls

no outgoing calls

Tested by 1