class_docstr: Represents the type of auto-sharding to use.
  
  OFF: No sharding will be performed.
  
  AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding.
  
  FILE: Shards by input files (i.e. each worker will get a set of files to
  process). When this option is selected, make sure that there is at least as
  many files as workers. If there are fewer input files than workers, a runtime
  error will be raised.
  
  DATA: Shards by elements produced by the dataset. Each worker will process the
  whole dataset and discard the portion that is not for itself. Note that for
  this mode to correctly partitions the dataset elements, the dataset needs to
  produce elements in a deterministic order.
  
  HINT: Looks for the presence of `shard(SHARD_HINT, ...)` which is treated as a
  placeholder to replace with `shard(num_workers, worker_index)`.
class_docstr_tok: ["Represents","the","type","of","auto-sharding","to","use",".","OFF",":","No","sharding","will","be","performed",".","AUTO",":","Attempts","FILE-based","sharding",",","falling","back","to","DATA-based","sharding",".","FILE",":","Shards","by","input","files","(","i.e",".","each","worker","will","get","a","set","of","files","to","process",")",".","When","this","option","is","selected",",","make","sure","that","there","is","at","least","as","many","files","as","workers",".","If","there","are","fewer","input","files","than","workers",",","a","runtime","error","will","be","raised",".","DATA",":","Shards","by","elements","produced","by","the","dataset",".","Each","worker","will","process","the","whole","dataset","and","discard","the","portion","that","is","not","for","itself",".","Note","that","for","this","mode","to","correctly","partitions","the","dataset","elements",",","the","dataset","needs","to","produce","elements","in","a","deterministic","order",".","HINT",":","Looks","for","the","presence","of","`","shard","(","SHARD_HINT",",","...",")","`","which","is","treated","as","a","placeholder","to","replace","with","`","shard","(","num_workers",",","worker_index",")","`","."]
docstr: Convert proto to enum.
docstr_tok: ["Convert","proto","to","enum","."]
code: def _from_proto(cls, pb):
      """Convert proto to enum."""
      if pb == dataset_options_pb2.AutoShardPolicy.OFF:
          return cls.OFF
      if pb == dataset_options_pb2.AutoShardPolicy.FILE:
          return cls.FILE
      if pb == dataset_options_pb2.AutoShardPolicy.DATA:
          return cls.DATA
      if pb == dataset_options_pb2.AutoShardPolicy.AUTO:
          return cls.AUTO
      if pb == dataset_options_pb2.AutoShardPolicy.HINT:
          return cls.HINT
      raise ValueError(
          f"Invalid `pb.` Supported values include `OFF`, `FILE`, `DATA`,"
          f"`AUTO`, and `HINT`. Got {pb}."
      )
  
imports: import enum
  import platform
  from absl import logging
  from tensorflow.core.framework import dataset_options_pb2
  from tensorflow.core.framework import model_pb2
  from tensorflow.python.data.ops import test_mode
  from tensorflow.python.data.util import options
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling the AutoShardPolicy obj's underlying member method code with example usage: obj._from_proto(cls, pb) and returns: cls, cls, cls, cls, cls