code: def _add_tensor_to_features(
      self, generator, feature_name, tensor, features
  ):
      spec = generator.spec
      if isinstance(spec, tf.TensorSpec):
          self._add_dense_tensor_to_features(
              feature_name, tensor, features
          )
      elif isinstance(spec, tf.SparseTensorSpec):
          if issubclass(
              generator.get_generator_cls(), VarLenTensorGeneratorBase
          ):
              self._add_dense_tensor_to_features(
                  feature_name, tf.sparse.to_dense(tensor), features
              )
          else:
              self._add_sparse_tensor_to_features(
                  feature_name, tensor, features
              )
      else:
          raise TypeError(f"Spec {spec} is not supported in ATDSWriter")
  
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 6 for calling the ATDSWriter obj's underlying member method code with example usage: obj._add_tensor_to_features(generator, feature_name, tensor, features) without return types