docstr: Build tf.Example parsing config
  
  Args:
    generator: A TensorGenerator, SparseTensorGenerator, or VarLenTensorGenerator for generating data.
  
  Returns:
    DenseFeature, SparseFeature, or VarlenFeature
  
  Raises:
    TypeError: if spec is not tf.TensorSpec or tf.SparseTensorSpec.
docstr_tok: ["Build","tf.Example","parsing","config","Args",":","generator",":","A","TensorGenerator",",","SparseTensorGenerator",",","or","VarLenTensorGenerator","for","generating","data",".","Returns",":","DenseFeature",",","SparseFeature",",","or","VarlenFeature","Raises",":","TypeError",":","if","spec","is","not","tf.TensorSpec","or","tf.SparseTensorSpec","."]
code: def _get_atds_feature(self, generator):
      """Build tf.Example parsing config
  
      Args:
        generator: A TensorGenerator, SparseTensorGenerator, or VarLenTensorGenerator for generating data.
  
      Returns:
        DenseFeature, SparseFeature, or VarlenFeature
  
      Raises:
        TypeError: if spec is not tf.TensorSpec or tf.SparseTensorSpec.
      """
      spec = generator.spec
      if isinstance(spec, tf.TensorSpec):
          return DenseFeature(
              shape=spec.shape.as_list(), dtype=spec.dtype
          )
      elif isinstance(spec, tf.SparseTensorSpec):
          if issubclass(
              generator.get_generator_cls(), VarLenTensorGeneratorBase
          ):
              atds_shape = [
                  -1 if dim == None else dim
                  for dim in spec.shape.as_list()
              ]
              return VarlenFeature(shape=atds_shape, dtype=spec.dtype)
          else:
              return SparseFeature(
                  shape=spec.shape.as_list(), dtype=spec.dtype
              )
      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 17 for calling the ATDSWriter obj's underlying member method code with example usage: obj._get_atds_feature(generator) and returns: DenseFeature, VarlenFeature, SparseFeature