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")
| 1089 | """ |
| 1090 | |
| 1091 | def __init__(self, kernel_size, stride=None, padding=0, pad_mode="NOTSET"): |
| 1092 | """ |
| 1093 | Args: |
| 1094 | kernel_size (int or tuple): kernel size for two direction of each |
| 1095 | axis. For example, (2, 3), the first 2 means will add 2 at the |
| 1096 | beginning and also 2 at the end for its axis.and if a int is |
| 1097 | accepted, the kernel size will be initiated as (int, int) |
| 1098 | stride (int or tuple): stride, the logic is the same as kernel size. |
| 1099 | padding (int): tuple, list or None, padding, the logic is the same |
| 1100 | as kernel size. However, if you set pad_mode as "SAME_UPPER" or |
| 1101 | "SAME_LOWER" mode, you can set padding as None, and the padding |
| 1102 | will be computed automatically. |
| 1103 | pad_mode (string): can be NOTSET, SAME_UPPER, or SAME_LOWER, where |
| 1104 | default value is NOTSET, which means explicit padding is used. |
| 1105 | SAME_UPPER or SAME_LOWER mean pad the input so that the output |
| 1106 | spatial size match the input. In case of odd number add the extra |
| 1107 | padding at the end for SAME_UPPER and at the beginning for SAME_LOWER. |
| 1108 | """ |
| 1109 | if stride is None: |
| 1110 | stride = kernel_size |
| 1111 | super(AvgPool1d, self).__init__((1, kernel_size), (1, stride), |
| 1112 | (0, padding), False, pad_mode) |
| 1113 | |
| 1114 | |
| 1115 | class RNN_Base(Layer): |