code: def ortho_init(scale=1.0):
      """
      Orthogonal initialization for the policy weights
  
      :param scale: (float) Scaling factor for the weights.
      :return: (function) an initialization function for the weights
      """
  
      # _ortho_init(shape, dtype, partition_info=None)
      def _ortho_init(shape, *_, **_kwargs):
          """Intialize weights as Orthogonal matrix.
  
          Orthogonal matrix initialization [1]_. For n-dimensional shapes where
          n > 2, the n-1 trailing axes are flattened. For convolutional layers, this
          corresponds to the fan-in, so this makes the initialization usable for
          both dense and convolutional layers.
  
          References
          ----------
          .. [1] Saxe, Andrew M., James L. McClelland, and Surya Ganguli.
                 "Exact solutions to the nonlinear dynamics of learning in deep
                 linear
          """
          # lasagne ortho init for tf
          shape = tuple(shape)
          if len(shape) == 2:
              flat_shape = shape
          elif len(shape) == 4:  # assumes NHWC
              flat_shape = (np.prod(shape[:-1]), shape[-1])
          else:
              raise NotImplementedError
          gaussian_noise = np.random.normal(0.0, 1.0, flat_shape)
          u, _, v = np.linalg.svd(gaussian_noise, full_matrices=False)
          weights = (
              u if u.shape == flat_shape else v
          )  # pick the one with the correct shape
          weights = weights.reshape(shape)
          return (scale * weights[: shape[0], : shape[1]]).astype(
              np.float32
          )
  
      return _ortho_init
  
file_path: stable-baselines/stable_baselines/common/tf_layers.py
imports: import numpy
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: ortho_init(scale) and returns: _ortho_init, unknown