Calculate output shape for pooling layer.
(pool_shape, image_shape, stride)
| 219 | |
| 220 | |
| 221 | def pooling_shape(pool_shape, image_shape, stride): |
| 222 | """Calculate output shape for pooling layer.""" |
| 223 | n_images, n_channels, height, width = image_shape |
| 224 | |
| 225 | height = (height - pool_shape[0]) / float(stride[0]) + 1 |
| 226 | width = (width - pool_shape[1]) / float(stride[1]) + 1 |
| 227 | |
| 228 | assert height % 1 == 0 |
| 229 | assert width % 1 == 0 |
| 230 | |
| 231 | return int(height), int(width) |