code: def write_numpy_to_dense_tensor(file, array, labels=None):
      """Writes a numpy array to a dense tensor
  
      Args:
          file:
          array:
          labels:
      """
  
      # 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())
  
imports: from __future__ import absolute_import
  import io
  import logging
  import struct
  import sys
  import numpy
  from sagemaker.amazon.record_pb2 import Record
  from sagemaker.deprecations import deprecated_class
  from sagemaker.deserializers import SimpleBaseDeserializer
  from sagemaker.serializers import SimpleBaseSerializer
  from sagemaker.utils import DeferredError
label_desc: Use image node_id 5 for calling a global function with example usage: write_numpy_to_dense_tensor(file, array, labels) without return types