class_docstr: Class for the space of matrices (m, n).
  
  Parameters
  ----------
  m, n : int
      Integers representing the shapes of the matrices: m x n.
class_docstr_tok: ["Class","for","the","space","of","matrices","(","m",",","n",")",".","Parameters","--","--","--","--","--","m",",","n",":","int","Integers","representing","the","shapes","of","the","matrices",":","m","x","n","."]
docstr: Return a flattened form of the matrix.
  
  Flatten a matrix (compatible with vectorization on data axis 0).
  The reverse operation is reshape. These operations are often called
  matrix vectorization / matricization in mathematics
  (https://en.wikipedia.org/wiki/Tensor_reshaping).
  The names flatten / reshape were chosen to avoid  confusion with
  vectorization on data axis 0.
  
  Parameters
  ----------
  mat : array-like, shape=[..., m, n]
      Matrix.
  
  Returns
  -------
  vec : array-like, shape=[..., m * n]
      Flatten copy of mat.
docstr_tok: ["Return","a","flattened","form","of","the","matrix",".","Flatten","a","matrix","(","compatible","with","vectorization","on","data","axis","0",")",".","The","reverse","operation","is","reshape",".","These","operations","are","often","called","matrix","vectorization","\/","matricization","in","mathematics","(","https",":","\/\/en.wikipedia.org\/wiki\/Tensor_reshaping",")",".","The","names","flatten","\/","reshape","were","chosen","to","avoid","confusion","with","vectorization","on","data","axis","0",".","Parameters","--","--","--","--","--","mat",":","array-like",",","shape=","[","...",",","m",",","n","]","Matrix",".","Returns","--","--","--","-","vec",":","array-like",",","shape=","[","...",",","m","*","n","]","Flatten","copy","of","mat","."]
code: def flatten(mat):
      """Return a flattened form of the matrix.
  
      Flatten a matrix (compatible with vectorization on data axis 0).
      The reverse operation is reshape. These operations are often called
      matrix vectorization / matricization in mathematics
      (https://en.wikipedia.org/wiki/Tensor_reshaping).
      The names flatten / reshape were chosen to avoid  confusion with
      vectorization on data axis 0.
  
      Parameters
      ----------
      mat : array-like, shape=[..., m, n]
          Matrix.
  
      Returns
      -------
      vec : array-like, shape=[..., m * n]
          Flatten copy of mat.
      """
      batch_shape = mat.shape[:-2]
      mat_shape = mat.shape[-2:]
      return gs.reshape(mat, batch_shape + (math.prod(mat_shape),))
  
imports: import logging
  import math
  from functools import reduce
  import geomstats.backend
  import geomstats.errors
  from geomstats.algebra_utils import flip_determinant, from_vector_to_diagonal_matrix
  from geomstats.geometry.base import MatrixVectorSpace
  from geomstats.geometry.euclidean import EuclideanMetric
  from geomstats.vectorization import repeat_out
label_desc: Use image node_id 32 for calling the Matrices obj's underlying member method code with example usage: obj.flatten(mat) and returns: gs