class_docstr: Base class for the pooling layers.
  
  Parameters
  ----------
  size : tuple with 2 integers
      Factor by which to downscale ``(vertical, horizontal)``.
      ``(2, 2)`` will halve the image in each dimension.
  
  stride : tuple or int.
      Stride size, which is the number of shifts over
      rows/cols to get the next pool region. If stride is
      ``None``, it is considered equal to ``size`` (no overlap on
      pooling regions).
  
  padding : {{``valid``, ``same``}}
      ``(pad_h, pad_w)``, pad zeros to extend beyond four borders of
      the images, pad_h is the size of the top and bottom margins,
      and pad_w is the size of the left and right margins.
  
  {BaseLayer.Parameters}
  
  Methods
  -------
  {BaseLayer.Methods}
  
  Attributes
  ----------
  {BaseLayer.Attributes}
class_docstr_tok: ["Base","class","for","the","pooling","layers",".","Parameters","--","--","--","--","--","size",":","tuple","with","2","integers","Factor","by","which","to","downscale","``","(","vertical",",","horizontal",")","``",".","``","(","2",",","2",")","``","will","halve","the","image","in","each","dimension",".","stride",":","tuple","or","int",".","Stride","size",",","which","is","the","number","of","shifts","over","rows\/cols","to","get","the","next","pool","region",".","If","stride","is","``","None","``",",","it","is","considered","equal","to","``","size","``","(","no","overlap","on","pooling","regions",")",".","padding",":","{","{","``","valid","``",",","``","same","``","}","}","``","(","pad_h",",","pad_w",")","``",",","pad","zeros","to","extend","beyond","four","borders","of","the","images",",","pad_h","is","the","size","of","the","top","and","bottom","margins",",","and","pad_w","is","the","size","of","the","left","and","right","margins",".","{","BaseLayer.Parameters","}","Methods","--","--","--","-","{","BaseLayer.Methods","}","Attributes","--","--","--","--","--","{","BaseLayer.Attributes","}"]
code: def fail_if_shape_invalid(self, input_shape):
      if input_shape and input_shape.ndims != 4:
          raise LayerConnectionError(
              "Pooling layer expects an input with 4 "
              "dimensions, got {} with shape {}. Layer: {}"
              "".format(len(input_shape), input_shape, self)
          )
  
imports: from __future__ import division
  import math
  import tensorflow
  from neupy.utils import as_tuple, tf_utils
  from neupy.core.properties import TypedListProperty, ChoiceProperty, FunctionWithOptionsProperty
  from neupy.exceptions import LayerConnectionError
  from .base import BaseLayer
  from .convolutions import Spatial2DProperty
label_desc: Use image node_id 2 for calling the BasePooling obj's underlying member method code with example usage: obj.fail_if_shape_invalid(input_shape) without return types