code: def test_recurrent_mean(backend_default, refgruargs, deltas_buffer):
      seq_len, nin, batch_size = refgruargs
      NervanaObject.be.bsz = batch_size
  
      in_shape = (nin, seq_len)
      layer = RecurrentMean()
      layer.configure(in_shape)
      layer.prev_layer = True
      layer.allocate()
  
      layer.allocate_deltas(deltas_buffer)
      deltas_buffer.allocate_buffers()
      layer.set_deltas(deltas_buffer)
  
      # zeros
      inp = layer.be.zeros((nin, seq_len * batch_size))
      out = layer.fprop(inp)
      err = layer.bprop(out).get()
      assert np.all(out.get() == np.zeros((nin, batch_size)))
      assert np.all(err == inp.get())
  
      # ones
      inp = layer.be.ones((nin, seq_len * batch_size))
      out = layer.fprop(inp)
      err = layer.bprop(out).get()
      assert np.all(out.get() == np.ones((nin, batch_size)))
      assert np.all(err == 1.0 / seq_len * inp.get())
  
      # random
      rinp = np.random.random((nin, batch_size))
      inp = np.repeat(rinp, repeats=seq_len, axis=1)
      inp_g = layer.be.array(inp)
      out = layer.fprop(inp_g)
      err = layer.bprop(out)
      assert allclose_with_out(out.get(), rinp)
      assert allclose_with_out(err.get(), 1.0 / seq_len * inp)
  
      # full random
      inp = np.random.random((nin, seq_len * batch_size))
      inp_g = layer.be.array(inp)
      out = layer.fprop(inp_g)
      err = layer.bprop(out)
      out_comp = np.zeros(out.shape)
      err_comp = np.zeros(inp.shape)
      for i in range(seq_len):
          out_comp[:] = (
              out_comp + inp[:, i * batch_size : (i + 1) * batch_size]
          )
          err_comp[
              :, i * batch_size : (i + 1) * batch_size
          ] = out.get() / float(seq_len)
      out_comp[:] /= float(seq_len)
  
      assert allclose_with_out(out_comp, out.get())
      assert allclose_with_out(err_comp, err.get())
  
file_path: neon/tests/test_recurrent_output.py
imports: import itertools
  import numpy
  from neon.backends import gen_backend
  from neon import NervanaObject
  from neon.layers.recurrent import RecurrentSum, RecurrentMean, RecurrentLast
  from utils import allclose_with_out
label_desc: Use image node_id 3 for calling a global function with example usage: test_recurrent_mean(backend_default, refgruargs, deltas_buffer) without return types