Args: kernel_size (int or tuple): kernel size for two direction of each axis. For example, (2, 3), the first 2 means will add 2 at the beginning and also 2 at the end for its axis.and if a int is accepted, the kernel size will be i
(self, kernel_size, stride=None, padding=0, pad_mode="NOTSET")
| 1060 | """ |
| 1061 | |
| 1062 | def __init__(self, kernel_size, stride=None, padding=0, pad_mode="NOTSET"): |
| 1063 | """ |
| 1064 | Args: |
| 1065 | kernel_size (int or tuple): kernel size for two direction of each |
| 1066 | axis. For example, (2, 3), the first 2 means will add 2 at the |
| 1067 | beginning and also 2 at the end for its axis.and if a int is |
| 1068 | accepted, the kernel size will be initiated as (int, int) |
| 1069 | stride (int or tuple): stride, the logic is the same as kernel size. |
| 1070 | padding (int): tuple, list or None, padding, the logic is the same |
| 1071 | as kernel size. However, if you set pad_mode as "SAME_UPPER" or |
| 1072 | "SAME_LOWER" mode, you can set padding as None, and the padding |
| 1073 | will be computed automatically. |
| 1074 | pad_mode (string): can be NOTSET, SAME_UPPER, or SAME_LOWER, where |
| 1075 | default value is NOTSET, which means explicit padding is used. |
| 1076 | SAME_UPPER or SAME_LOWER mean pad the input so that the output |
| 1077 | spatial size match the input. In case of odd number add the extra |
| 1078 | padding at the end for SAME_UPPER and at the beginning for SAME_LOWER. |
| 1079 | """ |
| 1080 | if stride is None: |
| 1081 | stride = kernel_size |
| 1082 | super(MaxPool1d, self).__init__((1, kernel_size), (1, stride), |
| 1083 | (0, padding), True, pad_mode) |
| 1084 | |
| 1085 | |
| 1086 | class AvgPool1d(Pooling2d): |