Fixed some errors in layer_factory and cudnn_pooling

I guess Travis doesn't check builds with CUDNN active. You shouldn't be able to build the current dev if you have CUDNN active, and this patch fixes the errors.