code: def test_biRNN_bprop(backend_default, fargs, deltas_buffer):
      # basic sanity check with 0 weights random inputs
      seq_len, input_size, hidden_size, batch_size = fargs
      in_shape = (input_size, seq_len)
      NervanaObject.be.bsz = batch_size
  
      # setup the bi-directional rnn
      init_glorot = GlorotUniform()
      birnn = BiRNN(
          hidden_size, activation=Rectlinclip(slope=0), init=init_glorot
      )
      birnn.configure(in_shape)
      birnn.prev_layer = True
      birnn.allocate()
  
      birnn.allocate_deltas(deltas_buffer)
      deltas_buffer.allocate_buffers()
      birnn.set_deltas(deltas_buffer)
  
      # same weight for bi-rnn backward and rnn weights
      birnn.W_input_b[:] = birnn.W_input_f
      birnn.W_recur_b[:] = birnn.W_recur_f
      birnn.b_b[:] = birnn.b_f
      birnn.dW[:] = 0
  
      # same weight for bi-directional rnn
      init_glorot = GlorotUniform()
      rnn = Recurrent(
          hidden_size, activation=Rectlinclip(slope=0), init=init_glorot
      )
      rnn.configure(in_shape)
      rnn.prev_layer = True
      rnn.allocate()
  
      rnn.allocate_deltas(deltas_buffer)
      deltas_buffer.allocate_buffers()
      rnn.set_deltas(deltas_buffer)
  
      # inputs and views
      lr = np.random.random((input_size, seq_len * batch_size))
      lr_rev = list(reversed(get_steps(lr.copy(), in_shape)))
      rl = con(lr_rev, axis=1)
  
      # allocate gpu buffers
      inp_lr = birnn.be.array(lr)
      inp_rl = birnn.be.array(rl)
  
      # outputs
      out_lr_g = birnn.fprop(inp_lr)
      del_lr = birnn.bprop(out_lr_g).get().copy()
      birnn.h_buffer[:] = 0
      out_rl_g = birnn.fprop(inp_rl)
      del_rl = birnn.bprop(out_rl_g).get().copy()
  
      del_lr_s = get_steps(del_lr, in_shape)
      del_rl_s = get_steps(del_rl, in_shape)
      for x, y in zip(del_lr_s, reversed(del_rl_s)):
          assert allclose_with_out(x, y, rtol=0.0, atol=1.0e-5)
  
file_path: neon/tests/test_birnn.py
imports: from builtins import zip
  import itertools
  import numpy
  from numpy import concatenate
  from neon import NervanaObject
  from neon.initializers.initializer import GlorotUniform
  from neon.layers.recurrent import BiRNN, Recurrent, get_steps, BiSum, BiBNRNN
  from neon.transforms import Rectlinclip
  from utils import allclose_with_out
label_desc: Use image node_id 4 for calling a global function with example usage: test_biRNN_bprop(backend_default, fargs, deltas_buffer) without return types