code: def _SolveWithNumpy(matrix, rhs, l2_regularizer=0):
      if l2_regularizer == 0:
          np_ans, _, _, _ = np.linalg.lstsq(matrix, rhs)
          return np_ans
      else:
          rows = matrix.shape[-2]
          cols = matrix.shape[-1]
          if rows >= cols:
              preconditioner = l2_regularizer * np.identity(cols)
              gramian = (
                  np.dot(np.conj(matrix.T), matrix) + preconditioner
              )
              rhs = np.dot(np.conj(matrix.T), rhs)
              return np.linalg.solve(gramian, rhs)
          else:
              preconditioner = l2_regularizer * np.identity(rows)
              gramian = (
                  np.dot(matrix, np.conj(matrix.T)) + preconditioner
              )
              z = np.linalg.solve(gramian, rhs)
              return np.dot(np.conj(matrix.T), z)
  
imports: import numpy
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import linalg_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import benchmark
  from tensorflow.python.platform import test
label_desc: Use image node_id 3 for calling a global function with example usage: _SolveWithNumpy(matrix, rhs, l2_regularizer) and returns: np_ans, np, np