Implementation of CNN which uses sorting layers and an automatically learned pooling function instead of hard coded pooling functions