code: def test_biLSTM_fprop(backend_default, fargs):
      # basic sanity check with 0 weights random inputs
      seq_len, input_size, hidden_size, batch_size = fargs
      in_shape = (input_size, seq_len)
      out_shape = (hidden_size, seq_len)
      NervanaObject.be.bsz = batch_size
  
      # setup the bi-directional rnn
      init_glorot = GlorotUniform()
      bilstm = BiLSTM(
          hidden_size,
          gate_activation=Logistic(),
          init=init_glorot,
          activation=Tanh(),
          reset_cells=True,
      )
      bilstm.configure(in_shape)
      bilstm.prev_layer = True
      bilstm.allocate()
  
      # same weight
      nout = hidden_size
      bilstm.W_input_b[:] = bilstm.W_input_f
      bilstm.W_recur_b[:] = bilstm.W_recur_f
      bilstm.b_b[:] = bilstm.b_f
      bilstm.dW[:] = 0
  
      # inputs - random and flipped left-to-right inputs
      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)
      inp_lr = bilstm.be.array(lr)
      inp_rl = bilstm.be.array(rl)
  
      # outputs
      out_lr = bilstm.fprop(inp_lr).get().copy()
  
      bilstm.h_buffer[:] = 0
      out_rl = bilstm.fprop(inp_rl).get().copy()
  
      # views
      out_lr_f_s = get_steps(out_lr[:nout], out_shape)
      out_lr_b_s = get_steps(out_lr[nout:], out_shape)
      out_rl_f_s = get_steps(out_rl[:nout], out_shape)
      out_rl_b_s = get_steps(out_rl[nout:], out_shape)
  
      # asserts
      for x_f, x_b, y_f, y_b in zip(
          out_lr_f_s,
          out_lr_b_s,
          reversed(out_rl_f_s),
          reversed(out_rl_b_s),
      ):
          assert allclose_with_out(x_f, y_b, rtol=0.0, atol=1.0e-5)
          assert allclose_with_out(x_b, y_f, rtol=0.0, atol=1.0e-5)
  
file_path: neon/tests/test_bilstm.py
imports: from builtins import zip
  import itertools
  import numpy
  from neon import NervanaObject
  from neon.initializers.initializer import GlorotUniform
  from neon.layers.recurrent import BiLSTM, LSTM, get_steps
  from neon.transforms import Logistic, Tanh
  from numpy import concatenate
  from utils import allclose_with_out
label_desc: Use image node_id 3 for calling a global function with example usage: test_biLSTM_fprop(backend_default, fargs) without return types