code: def permutation(
      random_state, size=None, n=1, ndim=None, dtype="int64"
  ):
      """
      Return permutations of the integers between 0 and n-1.
  
      Returns them as many times as required by size. For instance, if size=(p,q),
      p*q permutations will be generated, and the output shape will be (p,q,n),
      because each permutation is of size n.
  
      Theano tries to infer the number of dimensions from the length of
      the size argument and the shape of n, but you may always specify it
      with the `ndim` parameter.
  
      Notes
      -----
      Note that the output will then be of dimension ndim+1.
  
      """
      if size is None or size == ():
          if not (ndim is None or ndim == 1):
              raise TypeError(
                  "You asked for just one permutation but asked for more then 1 dimensions."
              )
          ndim = 1
          size = ()
          bcast = ()
      else:
          ndim, size, bcast = _infer_ndim_bcast(ndim, size)
      # print "NDIM", ndim, size
      op = RandomFunction(
          permutation_helper,
          tensor.TensorType(
              dtype=dtype, broadcastable=bcast + (False,)
          ),
          ndim_added=1,
      )
      return op(random_state, size, n)
  
imports: from __future__ import absolute_import, print_function, division
  import sys
  from copy import copy
  import numpy
  from six import string_types
  from six.moves import reduce, xrange
  import theano
  from theano import tensor
  from theano.tensor import opt
  from theano import gof
  from theano.compile import optdb
label_desc: Use image node_id 12 for calling a global function with example usage: permutation(random_state, size, n, ndim, dtype) and returns: op