class_docstr: Box collection.
class_docstr_tok: ["Box","collection","."]
docstr: Retrieves specified fields as a dictionary of tensors.
  
  Args:
    fields: (optional) list of fields to return in the dictionary.
      If None (default), all fields are returned.
  
  Returns:
    tensor_dict: A dictionary of tensors specified by fields.
  
  Raises:
    ValueError: if specified field is not contained in boxlist.
docstr_tok: ["Retrieves","specified","fields","as","a","dictionary","of","tensors",".","Args",":","fields",":","(","optional",")","list","of","fields","to","return","in","the","dictionary",".","If","None","(","default",")",",","all","fields","are","returned",".","Returns",":","tensor_dict",":","A","dictionary","of","tensors","specified","by","fields",".","Raises",":","ValueError",":","if","specified","field","is","not","contained","in","boxlist","."]
code: def as_tensor_dict(self, fields=None):
      """Retrieves specified fields as a dictionary of tensors.
  
      Args:
        fields: (optional) list of fields to return in the dictionary.
          If None (default), all fields are returned.
  
      Returns:
        tensor_dict: A dictionary of tensors specified by fields.
  
      Raises:
        ValueError: if specified field is not contained in boxlist.
      """
      tensor_dict = {}
      if fields is None:
          fields = self.get_all_fields()
      for field in fields:
          if not self.has_field(field):
              raise ValueError(
                  "boxlist must contain all specified fields"
              )
          tensor_dict[field] = self.get_field(field)
      return tensor_dict
  
file_path: DALI/docs/examples/use_cases/tensorflow/efficientdet/pipeline/anchors_utils/box_list.py
imports: import tensorflow.compat.v1
label_desc: Use image node_id 14 for calling the BoxList obj's underlying member method code with example usage: obj.as_tensor_dict(fields) and returns: tensor_dict