class_docstr: Memory component in a memory network.
  
  Args:
      A (chainer.links.EmbedID): Embed matrix for input. Its shape is
          ``(n_vocab, n_units)``.
      C (chainer.links.EmbedID): Embed matrix for output. Its shape is
          ``(n_vocab, n_units)``.
      TA (chainer.links.EmbedID): Embed matrix for temporal encoding for
          input. Its shape is ``(max_memory, n_units)``.
      TC (chainer.links.EmbedID): Embed matrix for temporal encoding for
          output. Its shape is ``(max_memory, n_units)``.
      encoder (callable): It encodes given stentences to embed vectors.
class_docstr_tok: ["Memory","component","in","a","memory","network",".","Args",":","A","(","chainer.links.EmbedID",")",":","Embed","matrix","for","input",".","Its","shape","is","``","(","n_vocab",",","n_units",")","``",".","C","(","chainer.links.EmbedID",")",":","Embed","matrix","for","output",".","Its","shape","is","``","(","n_vocab",",","n_units",")","``",".","TA","(","chainer.links.EmbedID",")",":","Embed","matrix","for","temporal","encoding","for","input",".","Its","shape","is","``","(","max_memory",",","n_units",")","``",".","TC","(","chainer.links.EmbedID",")",":","Embed","matrix","for","temporal","encoding","for","output",".","Its","shape","is","``","(","max_memory",",","n_units",")","``",".","encoder","(","callable",")",":","It","encodes","given","stentences","to","embed","vectors","."]
code: def query(self, u):
      xp = backend.get_array_module(u)
      size = self.m.shape[1]
      inds = xp.arange(size - 1, -1, -1, dtype=numpy.int32)
      tm = self.TA(inds)
      tc = self.TC(inds)
      tm = F.broadcast_to(tm, self.m.shape)
      tc = F.broadcast_to(tc, self.c.shape)
      p = F.softmax(F.matmul(self.m + tm, F.expand_dims(u, -1)))
      o = F.matmul(F.swapaxes(self.c + tc, 2, 1), p)
      o = F.squeeze(o, -1)
      u = o + u
      return u
  
imports: import collections
  import json
  import os
  import numpy
  import six
  import chainer
  from chainer import backend
  import chainer.functions
  from chainer import initializers
  import chainer.links
  import babi
label_desc: Use image node_id 3 for calling the Memory obj's underlying member method code with example usage: obj.query(u) and returns: u