class_docstr: Defines a vocabulary object that will be used to numericalize a field.
  
  Attributes:
      freqs: A collections.Counter object holding the frequencies of tokens
          in the data used to build the Vocab.
      stoi: A collections.defaultdict instance mapping token strings to
          numerical identifiers.
      itos: A list of token strings indexed by their numerical identifiers.
class_docstr_tok: ["Defines","a","vocabulary","object","that","will","be","used","to","numericalize","a","field",".","Attributes",":","freqs",":","A","collections.Counter","object","holding","the","frequencies","of","tokens","in","the","data","used","to","build","the","Vocab",".","stoi",":","A","collections.defaultdict","instance","mapping","token","strings","to","numerical","identifiers",".","itos",":","A","list","of","token","strings","indexed","by","their","numerical","identifiers","."]
docstr: Set the vectors for the Vocab instance from a collection of Tensors.
  
  Args:
      stoi: A dictionary of string to the index of the associated vector
          in the `vectors` input argument.
      vectors: An indexed iterable (or other structure supporting __getitem__) that
          given an input index, returns a FloatTensor representing the vector
          for the token associated with the index. For example,
          vector[stoi["string"]] should return the vector for "string".
      dim: The dimensionality of the vectors.
      unk_init (callback): by default, initialize out-of-vocabulary word vectors
          to zero vectors; can be any function that takes in a Tensor and
          returns a Tensor of the same size. Default: 'torch.zeros'
docstr_tok: ["Set","the","vectors","for","the","Vocab","instance","from","a","collection","of","Tensors",".","Args",":","stoi",":","A","dictionary","of","string","to","the","index","of","the","associated","vector","in","the","`","vectors","`","input","argument",".","vectors",":","An","indexed","iterable","(","or","other","structure","supporting","__getitem__",")","that","given","an","input","index",",","returns","a","FloatTensor","representing","the","vector","for","the","token","associated","with","the","index",".","For","example",",","vector","[","stoi","[","``","string","''","]","]","should","return","the","vector","for","``","string","''",".","dim",":","The","dimensionality","of","the","vectors",".","unk_init","(","callback",")",":","by","default",",","initialize","out-of-vocabulary","word","vectors","to","zero","vectors",";","can","be","any","function","that","takes","in","a","Tensor","and","returns","a","Tensor","of","the","same","size",".","Default",":","'torch.zeros","'"]
code: def set_vectors(
      self, stoi, vectors, dim, unk_init=torch.Tensor.zero_
  ):
      """
      Set the vectors for the Vocab instance from a collection of Tensors.
  
      Args:
          stoi: A dictionary of string to the index of the associated vector
              in the `vectors` input argument.
          vectors: An indexed iterable (or other structure supporting __getitem__) that
              given an input index, returns a FloatTensor representing the vector
              for the token associated with the index. For example,
              vector[stoi["string"]] should return the vector for "string".
          dim: The dimensionality of the vectors.
          unk_init (callback): by default, initialize out-of-vocabulary word vectors
              to zero vectors; can be any function that takes in a Tensor and
              returns a Tensor of the same size. Default: 'torch.zeros'
      """
      self.vectors = torch.Tensor(len(self), dim)
      for i, token in enumerate(self.itos):
          wv_index = stoi.get(token, None)
          if wv_index is not None:
              self.vectors[i] = vectors[wv_index]
          else:
              self.vectors[i] = unk_init(self.vectors[i])
  
file_path: pytext/pytext/legacy/vocab.py
imports: import logging
  from collections import Counter, defaultdict
  import torch
  from torchtext.vocab import pretrained_aliases, Vectors
  from tqdm import tqdm
label_desc: Use image node_id 11 for calling the Vocab obj's underlying member method code with example usage: obj.set_vectors(stoi, vectors, dim, unk_init) without return types