

pytorchのコードを見ていたところ、

[code]

    class Conv1d(_ConvNd):
        def __init__(
            self,
            in_channels: int,
            out_channels: int,
            kernel_size: _size_1_t,
            stride: _size_1_t = 1,
            padding: _size_1_t = 0,
            dilation: _size_1_t = 1,
            groups: int = 1,
            bias: bool = True,
            padding_mode: str = 'zeros'  # TODO: refine this type
        ):
            # we create new variables below to make mypy happy since kernel_size has
            # type Union[int, Tuple[int]] and kernel_size_ has type Tuple[int]
            kernel_size_ = _single(kernel_size)
            stride_ = _single(stride)
            padding_ = _single(padding)
            dilation_ = _single(dilation)
            super(Conv1d, self).__init__(
                in_channels, out_channels, kernel_size_, stride_, padding_, dilation_,
                False, _single(0), groups, bias, padding_mode)
    
[/code]

と、記載があり、

[code]

            super(Conv1d, self).__init__(
                in_channels, out_channels, kernel_size_, stride_, padding_, dilation_,
                False, _single(0), groups, bias, padding_mode)
    
[/code]

のsuperが何をしているのかがいまいち理解できません。  
自分自身を継承？このコードの意味を教えてください。


CC BY-SA 4.0
2021-01-29T09:42:26.270
73684
2021-01-29T16:19:55.933
2021-01-29T16:19:55.933
19110
42741
question
python python3 pytorch
pythonの継承で使われるsuper(Conv1d, self)が分かりません。