native implementation of pooling.