code: def identity(name, dim, scale=1, dtype=tf.sg_floatx, summary=True, regularizer=None, trainable=True):
      r
      x = tf.get_variable(name,
                          initializer=tf.constant(np.eye(dim) * scale, dtype=dtype),
                          regularizer=regularizer, trainable=trainable)
      # add summary
      if summary:
          tf.sg_summary_param(x)
      return x
docs: r"""Creates a tensor variable of which initial values are of
      an identity matrix.
      
      Note that the default value of `scale` (=0.05) is different from 
      the min/max values (=0.0, 1.0) of tf.random_uniform_initializer.
      
      For example,
      
      ```
      identity("identity", 3, 2) =>
      [[2. 0. 0.]
       [0. 2. 0.]
       [0. 0. 2.]]
      ```
      
      Args:
        name: The name of new variable.
        dim: An int. The size of the first and second dimension of the output tensor.
        scale: A Python scalar. The value on the diagonal.
        dtype: The type of the elements of the resulting tensor.
        summary: If True, add this constant to tensor board summary.
        regularizer:  A (Tensor -> Tensor or None) function; the result of applying it on a newly created variable
          will be added to the collection tf.GraphKeys.REGULARIZATION_LOSSES and can be used for regularization
        trainable: If True, add this constant to trainable collection. Default is True.
  
      Returns:
        A 2-D `Variable`.