code: def write_numpy_to_dense_tensor(file, array, labels=None):
      
  
      # Validate shape of array and labels, resolve array and label types
      if not len(array.shape) == 2:
          raise ValueError("Array must be a Matrix")
      if labels is not None:
          if not len(labels.shape) == 1:
              raise ValueError("Labels must be a Vector")
          if labels.shape[0] not in array.shape:
              raise ValueError("Label shape {} not compatible with array shape {}".format(
                               labels.shape, array.shape))
          resolved_label_type = _resolve_type(labels.dtype)
      resolved_type = _resolve_type(array.dtype)
  
      # Write each vector in array into a Record in the file object
      record = Record()
      for index, vector in enumerate(array):
          record.Clear()
          _write_feature_tensor(resolved_type, record, vector)
          if labels is not None:
              _write_label_tensor(resolved_label_type, record, labels[index])
          _write_recordio(file, record.SerializeToString())
docs: Writes a numpy array to a dense tensor