class_docstr: A ``Field`` is some piece of a data instance that ends up as an tensor in a model (either as an
  input or an output).  Data instances are just collections of fields.
  
  Fields go through up to two steps of processing: (1) tokenized fields are converted into token
  ids, (2) fields containing token ids (or any other numeric data) are padded (if necessary) and
  converted into tensors.  The ``Field`` API has methods around both of these steps, though they
  may not be needed for some concrete ``Field`` classes - if your field doesn't have any strings
  that need indexing, you don't need to implement ``count_vocab_items`` or ``index``.  These
  methods ``pass`` by default.
  
  Once a vocabulary is computed and all fields are indexed, we will determine padding lengths,
  then intelligently batch together instances and pad them into actual tensors.
docstr: Given a :class:`Vocabulary`, converts all strings in this field into (typically) integers.
  This `modifies` the ``Field`` object, it does not return anything.
  
  If your ``Field`` does not have any strings that need to be converted into indices, you do
  not need to implement this method.
docstr_tok: ["Given","a",":","class",":","`","Vocabulary","`",",","converts","all","strings","in","this","field","into","(","typically",")","integers",".","This","`","modifies","`","the","``","Field","``","object",",","it","does","not","return","anything",".","If","your","``","Field","``","does","not","have","any","strings","that","need","to","be","converted","into","indices",",","you","do","not","need","to","implement","this","method","."]
code: def index(self, vocab):
      """
      Given a :class:`Vocabulary`, converts all strings in this field into (typically) integers.
      This `modifies` the ``Field`` object, it does not return anything.
  
      If your ``Field`` does not have any strings that need to be converted into indices, you do
      not need to implement this method.
      """
      pass
  
file_path: magnitude/pymagnitude/third_party/allennlp/data/fields/field.py
imports: from __future__ import absolute_import
  import torch
  from allennlp.data.vocabulary import Vocabulary
label_desc: Use image node_id 2 for calling the Field obj's underlying member method code with example usage: obj.index(vocab) without return types