class_docstr: Parsing config for a feature in ELWCs.
class_docstr_tok: ["Parsing","config","for","a","feature","in","ELWCs","."]
docstr: Initializer.
  
  Args:
    name: Name of the feature.
    dtype: Dtype of the feature. One of tf.string, tf.int64 or tf.float32.
      Note that if the actual ELWC does not contain the corresponding oneof
      (for example, if dtype is tf.string, but ELWC contains float_values),
      the feature will be parsed as an empty list
      (also see `default_value` below).
    default_value: Default value of the feature. If specified, must also
     specify `length`. For instances that do not have the specified length,
     it will be padded with the default value.
    length: The length of the feature. If specified, must also specify
      `default_value`.
docstr_tok: ["Initializer",".","Args",":","name",":","Name","of","the","feature",".","dtype",":","Dtype","of","the","feature",".","One","of","tf.string",",","tf.int64","or","tf.float32",".","Note","that","if","the","actual","ELWC","does","not","contain","the","corresponding","oneof","(","for","example",",","if","dtype","is","tf.string",",","but","ELWC","contains","float_values",")",",","the","feature","will","be","parsed","as","an","empty","list","(","also","see","`","default_value","`","below",")",".","default_value",":","Default","value","of","the","feature",".","If","specified",",","must","also","specify","`","length","`",".","For","instances","that","do","not","have","the","specified","length",",","it","will","be","padded","with","the","default","value",".","length",":","The","length","of","the","feature",".","If","specified",",","must","also","specify","`","default_value","`","."]
code: def __init__(
      self,
      name: str,
      dtype: tf.DType,
      default_value: Optional[Union[int, float, str]] = None,
      length: Optional[int] = None,
  ):
      """Initializer.
  
      Args:
        name: Name of the feature.
        dtype: Dtype of the feature. One of tf.string, tf.int64 or tf.float32.
          Note that if the actual ELWC does not contain the corresponding oneof
          (for example, if dtype is tf.string, but ELWC contains float_values),
          the feature will be parsed as an empty list
          (also see `default_value` below).
        default_value: Default value of the feature. If specified, must also
         specify `length`. For instances that do not have the specified length,
         it will be padded with the default value.
        length: The length of the feature. If specified, must also specify
          `default_value`.
      """
      self.name = name
      self.dtype = dtype
      self.default_value = default_value
      self.length = length
  
      assert dtype in _TYPE_LIST_MAP, (
          "Feature %s must have a dtype of tf.string, tf.int64 or tf.float32"
          % name
      )
      assert (default_value is None and length is None) or (
          default_value is not None and length is not None
      ), (
          "Feature %s: default_value and length must both be specified "
          "or not specified" % name
      )
      if default_value is not None:
          assert (
              (dtype == tf.string and isinstance(default_value, bytes))
              or (dtype == tf.int64 and isinstance(default_value, int))
              or (
                  dtype == tf.float32
                  and isinstance(default_value, float)
              )
          ), (
              "Feature %s: type of default_value (%s) must match "
              "dtype" % (name, type(default_value))
          )
  
file_path: tfx/tfx/examples/ranking/struct2tensor_parsing_utils.py
imports: import itertools
  from typing import Dict, List, Optional, Union
  from struct2tensor import calculate
  from struct2tensor import calculate_options
  from struct2tensor import path
  from struct2tensor import prensor_util
  from struct2tensor.expression_impl import proto
  import tensorflow
  from tfx_bsl.public import tfxio
  from tensorflow_serving.apis import input_pb2
label_desc: Use image node_id 1 to create a new Feature object  with example: obj = Feature(name, dtype, default_value, length)