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)
code: def __new__(cls, *args, **kwargs):
      if len(kwargs) == 0:
          return super(AttrTensor, cls).__new__(cls, *args)
      else:
          name = kwargs["name"]
          attr = kwargs["attr"]
          train_info = kwargs["train_info"]
          if isinstance(attr, tuple):
              data = attr[0]
              lengths = attr[1]
          else:
              data = attr
              lengths = None
          word_probs = None
          if "word_probs" in train_info.metadata:
              raw_word_probs = train_info.metadata["word_probs"][name]
              word_probs = torch.Tensor(
                  [
                      [raw_word_probs[int(w)] for w in b]
                      for b in data.data
                  ]
              )
              if data.is_cuda:
                  word_probs = word_probs.cuda()
          pc = None
          if "pc" in train_info.metadata:
              pc = torch.Tensor(train_info.metadata["pc"][name])
              if data.is_cuda:
                  pc = pc.cuda()
          return AttrTensor(data, lengths, word_probs, pc)
  
file_path: deepmatcher/deepmatcher/batch.py
imports: from collections import namedtuple
  import torch
label_desc: Use image node_id 1 for calling the AttrTensor obj's underlying member method code with example usage: obj.__new__(cls) and returns: super, AttrTensor