code: def bow_encode(embed, sentences):
      """BoW sentence encoder.
  
      It is defined as:
  
      .. math::
  
         m = \\sum_j A x_j,
  
      where :math:`A` is an embed matrix, and :math:`x_j` is :math:`j`-th word
      ID.
  
      """
  
      e = embed(sentences)
      s = F.sum(e, axis=-2)
      return s
  
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 1 for calling a global function with example usage: bow_encode(embed, sentences) and returns: s