code: def _add_sparse_tensor_to_features(self, name, tensor, features):
      rank = len(tensor.shape.as_list())
      indices = (
          tensor.indices.numpy()
      )  # indices tensor must be a 2D array
      # Split indices array along the second dimension so that the split arrays
      # contain the indices for separate dimension. For example,
      # indices = [[0, 1], [2, 3], [4, 5]] =>
      #   indices_at_dim0 = [[0], [2], [4]] and
      #   indices_at_dim1 = [[1], [3], [5]].
      split_indices = np.split(indices, rank, axis=1)
      features[name] = {}
      for dim in range(rank):
          indices_name_at_dim = ATDSWriter._SPARSE_INDICES_KEY + str(
              dim
          )
          # convert indices to 1d array
          features[name][indices_name_at_dim] = (
              split_indices[dim].flatten().tolist()
          )
  
      features[name][
          ATDSWriter._SPARSE_VALUES_KEY
      ] = self._get_flat_value(tensor.values)
  
imports: import os
  import hashlib
  import json
  import numpy
  import tensorflow
  from avro.schema import Parse
  from avro.datafile import DataFileWriter
  from avro.io import DatumWriter
  from tests.test_atds_avro.utils.file_writer import FileWriter
  from tests.test_atds_avro.utils.generator.varlen_tensor_generator import VarLenTensorGeneratorBase
  from tensorflow_io.python.experimental.atds.features import DenseFeature, SparseFeature, VarlenFeature
label_desc: Use image node_id 16 for calling the ATDSWriter obj's underlying member method code with example usage: obj._add_sparse_tensor_to_features(name, tensor, features) without return types