class_docstr: A layer that rearranges the dimension of its input tensor, maintaining
  the same same total number of elements.
  
  Parameters
  ----------
  incoming : a :class:`Layer` instance or a tuple
      the layer feeding into this layer, or the expected input shape
  
  pattern : tuple
      The new dimension order, with each element giving the index
      of the dimension in the input tensor or `'x'` to broadcast it.
      For example `(3,2,1,0)` will reverse the order of a 4-dimensional
      tensor. Use `'x'` to broadcast, e.g. `(3,2,1,'x',0)` will
      take a 4 tensor of shape `(2,3,5,7)` as input and produce a
      tensor of shape `(7,5,3,1,2)` with the 4th dimension being
      broadcast-able. In general, all dimensions in the input tensor
      must be used to generate the output tensor. Omitting a dimension
      attempts to collapse it; this can only be done to broadcast-able
      dimensions, e.g. a 5-tensor of shape `(7,5,3,1,2)` with the 4th
      being broadcast-able can be shuffled with the pattern `(4,2,1,0)`
      collapsing the 4th dimension resulting in a tensor of shape
      `(2,3,5,7)`.
  
  Examples
  --------
  >>> from lasagne.layers import InputLayer, DimshuffleLayer
  >>> l_in = InputLayer((2, 3, 5, 7))
  >>> l1 = DimshuffleLayer(l_in, (3, 2, 1, 'x', 0))
  >>> l1.output_shape
  (7, 5, 3, 1, 2)
  >>> l2 = DimshuffleLayer(l1, (4, 2, 1, 0))
  >>> l2.output_shape
  (2, 3, 5, 7)
code: def get_output_shape_for(self, input_shape):
      # Build output shape while keeping track of the dimensions that we are
      # attempting to collapse, so we can ensure that they are broadcastable
      output_shape = []
      dims_used = [False] * len(input_shape)
      for p in self.pattern:
          if isinstance(p, int_types):
              if p < 0 or p >= len(input_shape):
                  raise ValueError(
                      "pattern contains {0}, but input shape "
                      "has {1} dimensions "
                      "only".format(p, len(input_shape))
                  )
              # Dimension p
              o = input_shape[p]
              dims_used[p] = True
          elif p == "x":
              # Broadcast; will be of size 1
              o = 1
          output_shape.append(o)
  
      for i, (dim_size, used) in enumerate(zip(input_shape, dims_used)):
          if not used and dim_size != 1 and dim_size is not None:
              raise ValueError(
                  "pattern attempted to collapse dimension "
                  "{0} of size {1}; dimensions with size != 1/None are not"
                  "broadcastable and cannot be "
                  "collapsed".format(i, dim_size)
              )
  
      return tuple(output_shape)
  
imports: import numpy
  import theano.tensor
  from ..theano_extensions import padding
  from ..utils import int_types
  from .base import Layer
label_desc: Use image node_id 2 for calling the DimshuffleLayer obj's underlying member method code with example usage: obj.get_output_shape_for(input_shape) and returns: tuple