class_docstr: Memory Network module.
class_docstr_tok: ["Memory","Network","module","."]
docstr: Initialize memnn model.
  
  See cmdline args in MemnnAgent for description of arguments.
docstr_tok: ["Initialize","memnn","model",".","See","cmdline","args","in","MemnnAgent","for","description","of","arguments","."]
code: def __init__(
      self,
      num_features,
      embedding_size,
      hops=1,
      memsize=32,
      time_features=False,
      position_encoding=False,
      dropout=0,
      padding_idx=0,
  ):
      """
      Initialize memnn model.
  
      See cmdline args in MemnnAgent for description of arguments.
      """
      super().__init__()
  
      # prepare features
      self.hops = hops
  
      def embedding(use_extra_feats=True):
          return Embed(
              num_features,
              embedding_size,
              position_encoding=position_encoding,
              padding_idx=padding_idx,
          )
  
      # TODO: add token dropout?
      # TODO: add dropout
      # self.dropout = nn.Dropout(dropout)
      # TODO: support more weight tying options?
      self.query_lt = embedding()
      self.in_memory_lt = embedding()
      self.out_memory_lt = embedding()
      self.answer_embedder = embedding()
      self.memory_hop = Hop(embedding_size)
  
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 MemNN object from inherited base classes: nn with example: obj = MemNN(num_features, embedding_size, hops, memsize, time_features, position_encoding, dropout, padding_idx)