code: def reshape_to_matrix(input_tensor):
      """Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix)."""
      ndims = input_tensor.shape.ndims
      if ndims < 2:
          raise ValueError(
              "Input tensor must have at least rank 2. Shape = %s"
              % (input_tensor.shape)
          )
      if ndims == 2:
          return input_tensor
  
      width = input_tensor.shape[-1]
      output_tensor = tf.reshape(input_tensor, [-1, width])
      return output_tensor
  
imports: import copy
  import json
  import math
  import numpy
  import tensorflow
  import functools
  from transformers.activations_tf import gelu
  from finetune.optimizers.recompute_grads import recompute_grad
  from finetune.nn.auxiliary import embed_position
label_desc: Use image node_id 17 for calling a global function with example usage: reshape_to_matrix(input_tensor) and returns: output_tensor, input_tensor