code: def _child_sum_tree_lstm(func, *inputs):
      cs = inputs[: len(inputs) // 2]
      hs = inputs[len(inputs) // 2 : -1]
      x = inputs[-1]
      device = backend.get_device_from_array(x)
      with chainer.using_device(device):
          xp = device.xp
          W_x = func.W_x.W.data.T
          b_x = func.W_x.b.data
          W_h_aio = func.W_h_aio.W.data.T
          W_h_f = func.W_h_f.W.data.T
  
          W_xa, W_xi, W_xo, W_xf = xp.split(W_x, 4, 1)
          b_a, b_i, b_o, b_f = xp.split(b_x[None,], 4, 1)
          W_ha, W_hi, W_ho = xp.split(W_h_aio, 3, 1)
          W_hf = W_h_f
  
          if len(hs) >= 1:
              sum_h = sum(hs)
              a = x.dot(W_xa) + sum_h.dot(W_ha) + b_a
              i = x.dot(W_xi) + sum_h.dot(W_hi) + b_i
              o = x.dot(W_xo) + sum_h.dot(W_ho) + b_o
              f_list = [x.dot(W_xf) + h.dot(W_hf) + b_f for h in hs]
          else:
              a = x.dot(W_xa) + b_a
              i = x.dot(W_xi) + b_i
              o = x.dot(W_xo) + b_o
          a = xp.tanh(a)
          i = _sigmoid(i)
          o = _sigmoid(o)
  
          if len(hs) >= 1:
              f_list = [_sigmoid(f) for f in f_list]
              c_next = sum([f * c for f, c in zip(f_list, cs)], a * i)
              y = o * xp.tanh(c_next)
          else:
              c_next = a * i
              y = o * xp.tanh(c_next)
      return c_next, y
  
imports: import unittest
  import numpy
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import gradient_check
  from chainer import links
  from chainer import testing
  from chainer.testing import attr
  from chainer.testing import condition
label_desc: Use image node_id 2 for calling a global function with example usage: _child_sum_tree_lstm(func) and returns: c_next,  y