class_docstr: Memory Network hop outputs attention-weighted sum of memory embeddings.
  
  0) rotate the query embeddings 1) compute the dot product between the input vector
  and each memory vector 2) compute a softmax over the memory scores 3) compute the
  weighted sum of the memory embeddings using the probabilities 4) add the query
  embedding to the memory output and return the result
class_docstr_tok: ["Memory","Network","hop","outputs","attention-weighted","sum","of","memory","embeddings",".","0",")","rotate","the","query","embeddings","1",")","compute","the","dot","product","between","the","input","vector","and","each","memory","vector","2",")","compute","a","softmax","over","the","memory","scores","3",")","compute","the","weighted","sum","of","the","memory","embeddings","using","the","probabilities","4",")","add","the","query","embedding","to","the","memory","output","and","return","the","result"]
docstr: Initialize linear rotation.
docstr_tok: ["Initialize","linear","rotation","."]
code: def __init__(self, embedding_size, rotate=True):
      """
      Initialize linear rotation.
      """
      super().__init__()
      if rotate:
          self.rotate = nn.Linear(
              embedding_size, embedding_size, bias=False
          )
      else:
          self.rotate = lambda x: x
      self.softmax = nn.Softmax(dim=1)
  
file_path: ParlAI/parlai/agents/memnn/modules.py
imports: import torch
  import torch.nn
  from parlai.utils.torch import neginf
  from functools import lru_cache
label_desc: Use image node_id 1 to create a new Hop object from inherited base classes: nn with example: obj = Hop(embedding_size, rotate)