|
1018 | 1018 | " self.gradb = np.zeros_like(self.b)\n",
|
1019 | 1019 | " \n",
|
1020 | 1020 | " def updateOutput(self, input):\n",
|
1021 |
| - " pad_size = self.kernel_size % 2\n", |
| 1021 | + " pad_size = self.kernel_size // 2\n", |
1022 | 1022 | " # YOUR CODE ##############################\n",
|
1023 | 1023 | " # 1. zero-pad the input array\n",
|
1024 | 1024 | " # 2. compute convolution using scipy.signal.correlate(... , mode='valid')\n",
|
|
1029 | 1029 | " return self.output\n",
|
1030 | 1030 | " \n",
|
1031 | 1031 | " def updateGradInput(self, input, gradOutput):\n",
|
1032 |
| - " pad_size = self.kernel_size % 2\n", |
| 1032 | + " pad_size = self.kernel_size // 2\n", |
1033 | 1033 | " # YOUR CODE ##############################\n",
|
1034 | 1034 | " # 1. zero-pad the gradOutput\n",
|
1035 | 1035 | " # 2. compute 'self.gradInput' value using scipy.signal.correlate(... , mode='valid')\n",
|
|
1039 | 1039 | " return self.gradInput\n",
|
1040 | 1040 | " \n",
|
1041 | 1041 | " def accGradParameters(self, input, gradOutput):\n",
|
1042 |
| - " pad_size = self.kernel_size % 2\n", |
| 1042 | + " pad_size = self.kernel_size // 2\n", |
1043 | 1043 | " # YOUR CODE #############\n",
|
1044 | 1044 | " # 1. zero-pad the input\n",
|
1045 | 1045 | " # 2. compute 'self.gradW' using scipy.signal.correlate(... , mode='valid')\n",
|
|
0 commit comments