code: def test_dense_to_sparse():
      array_data = [[1, 2, 3], [10, 20, 3]]
      array = np.array(array_data)
      label_data = np.array([99, 98, 97]).astype(np.dtype("float64"))
      with tempfile.TemporaryFile() as f:
          with pytest.raises(TypeError):
              write_spmatrix_to_sparse_tensor(f, array, label_data)
  
imports: from __future__ import absolute_import
  import numpy
  import tempfile
  import pytest
  import itertools
  from scipy.sparse import coo_matrix
  from sagemaker.amazon.common import RecordDeserializer, write_numpy_to_dense_tensor, read_recordio, RecordSerializer, write_spmatrix_to_sparse_tensor
  from sagemaker.amazon.record_pb2 import Record
label_desc: Use image node_id 22 for calling a global function with example usage: test_dense_to_sparse() without return types