I am working on neural networks with keras and tensorflow backend. 
Usually it is built up with convolutional and max pooling layers like it's done in vgg16 for example. For my neural network I would like to change max pooling layers to min pooling layers, but the layer should ignore zeros, when pooling.

For example:

[[0, 16], [72, 0]] the 2x2 pooling layer should pool 16 instead of 72 (max pooling).

Is there an easy way in keras to write this custom layer?

I guess that min pooling is possible via

```
min_x = -K.pool2d(-x, pool_size=(2, 2), strides=(2, 2))

```

Now it should ignore the zeros as minimums in addition.
Thanks for any help!