class_docstr: Base class for the recurrent layers
  
  Parameters
  ----------
  n_units : int
      Number of hidden units in the layer.
  
  only_return_final : bool
      If ``True``, only return the final sequential output
      (e.g. for tasks where a single target value for the entire
      sequence is desired). In this case, Tensorfow makes an
      optimization which saves memory. Defaults to ``True``.
  
  {BaseLayer.name}
code: def fail_if_shape_invalid(self, input_shape):
      if input_shape and input_shape.ndims != 3:
          clsname = self.__class__.__name__
          raise LayerConnectionError(
              "{} layer was expected input with three dimensions, "
              "but got input with {} dimensions instead. Layer: {}"
              "".format(clsname, input_shape.ndims, self)
          )
  
imports: import types
  import tensorflow
  from neupy import init
  from neupy.utils import tensorflow_session
  from neupy.exceptions import LayerConnectionError
  from neupy.core.properties import IntProperty, Property, NumberProperty, ParameterProperty
  from .base import BaseLayer
label_desc: Use image node_id 2 for calling the BaseRNNLayer obj's underlying member method code with example usage: obj.fail_if_shape_invalid(input_shape) without return types