class_docstr: A wrapper around the batch tensor for a specific attribute.
  
  The purpose of having a wrapper around the tensor is to include attribute specific
  metadata along with it. Metadata include the following:
  
  * ``lengths``: Lengths of each sequence (attribute value) in the batch.
  * ``word_probs``: For each sequence in the batch, a list of word probabilities
    corresponding to words in the sequence.
  * ``pc``: The first principal component of the sequence embeddings for all values of
    this attribute. For details on how this is computed refer documentation for
    :meth:`~deepmatcher.data.MatchingDataset.compute_metadata`. This is used for
    implementing the SIF model proposed in
    `this paper <https://openreview.net/pdf?id=SyK00v5xx>`__.
  
  This class is essentially a :class:`namedtuple`. The tensor containing the data and
  the associated metadata described above can be accessed as follows::
  
      name_attr = AttrTensor(data, lengths, word_probs, pc)
      assert(name_attr.data == data)
      assert(name_attr.lengths == lengths)
      assert(name_attr.word_probs == word_probs)
      assert(name_attr.pc == pc)
docstr: Wrap a PyTorch :class:`torch.Tensor` into an :class:`AttrTensor`.
  
  The metadata information is (shallow) copied from a pre-existing
  :class:`AttrTensor`. This is useful when the data for an attribute is
  transformed by a neural network and we wish the wrap the result into an
  :class:`AttrTensor` for further processing by another module that requires
  access to metadata.
  
  Args:
      old_attrtensor (:class:`AttrTensor`):
          The pre-existing :class:`AttrTensor` to copy metadata from.
docstr_tok: ["Wrap","a","PyTorch",":","class",":","`","torch.Tensor","`","into","an",":","class",":","`","AttrTensor","`",".","The","metadata","information","is","(","shallow",")","copied","from","a","pre-existing",":","class",":","`","AttrTensor","`",".","This","is","useful","when","the","data","for","an","attribute","is","transformed","by","a","neural","network","and","we","wish","the","wrap","the","result","into","an",":","class",":","`","AttrTensor","`","for","further","processing","by","another","module","that","requires","access","to","metadata",".","Args",":","old_attrtensor","(",":","class",":","`","AttrTensor","`",")",":","The","pre-existing",":","class",":","`","AttrTensor","`","to","copy","metadata","from","."]
code: def from_old_metadata(data, old_attrtensor):
      """Wrap a PyTorch :class:`torch.Tensor` into an :class:`AttrTensor`.
  
      The metadata information is (shallow) copied from a pre-existing
      :class:`AttrTensor`. This is useful when the data for an attribute is
      transformed by a neural network and we wish the wrap the result into an
      :class:`AttrTensor` for further processing by another module that requires
      access to metadata.
  
      Args:
          old_attrtensor (:class:`AttrTensor`):
              The pre-existing :class:`AttrTensor` to copy metadata from.
      """
      return AttrTensor(data, *old_attrtensor[1:])
  
file_path: deepmatcher/deepmatcher/batch.py
imports: from collections import namedtuple
  import torch
label_desc: Use image node_id 2 for calling the AttrTensor obj's underlying member method code with example usage: obj.from_old_metadata(data, old_attrtensor) and returns: AttrTensor