[MRG+1] Move pooling_func to constructor.

This is a partial fix for #1975.