As indicated in the comments the size after application of MaxPool is (B, H - S + 1, W - S + 1, C).įor a concreteness: if I use import numpy as np Each size of dimensions changes after the tensor is process by a layer, for example the input to layer i= 4 can have size B = 10, H = 24, W = 24, C = 3, while the output, aka input to i+1 layer has B = 10, H = 12, W = 12, C = 5. In my case tensors are 4-dimensional numpy.narray's, x. The input to a layers are numpy.narrays called "tensors". CNN has many "layers" where output of one layer is the input to the next layer. Some additional details: The network is implemented using numpy. That is, y is narray where the value at indexes b,h,w,c equals the maximum taken over the window of size S x S along the second and the third dimension of the input x, the window "corner" is placed at the indexes b,h,w,c. Y = MaxPool(x, S), x is an input narray and S is a parameter, using pseudocode, the output of the MaxPool is given by: y = max(x) over i = 0., S-1 j = 0.,S-1. In more details: I am implementing a convolutional neural network ("CNN"), one of the typical layers in such a network is MaxPool layer (look for example here). In short: I am looking for a simple numpy (maybe oneliner) implementation of Maxpool - maximum on a window on numpy.narray for all location of the window across dimensions.
0 Comments
Leave a Reply. |