code: def reshape_weight_to_matrix(self, weight):
      weight_mat = weight
      if self.dim != 0:
          # transpose dim to front
          weight_mat = weight_mat.transpose(
              [
                  self.dim,
                  *[
                      d
                      for d in range(weight_mat.dim())
                      if d != self.dim
                  ],
              ]
          )
  
      height = weight_mat.shape[0]
  
      return weight_mat.reshape([height, -1])
  
file_path: PaddleOCR/StyleText/arch/spectral_norm.py
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling the SpectralNorm obj's underlying member method code with example usage: obj.reshape_weight_to_matrix(weight) and returns: weight_mat