code: def test_projection():
      units = 6
      batch_size = 3
      projection = 5
      expected_output = np.array(
          [
              [1.697418, 1.697418, 1.697418, 1.697418, 1.697418],
              [1.840037, 1.840037, 1.840037, 1.840037, 1.840037],
              [1.873985, 1.873985, 1.873985, 1.873985, 1.873985],
          ]
      )
  
      expected_state = np.array(
          [
              [
                  0.69855207,
                  0.69855207,
                  0.69855207,
                  0.69855207,
                  0.69855207,
                  0.69855207,
                  1.69741797,
                  1.69741797,
                  1.69741797,
                  1.69741797,
                  1.69741797,
              ],
              [
                  0.77073824,
                  0.77073824,
                  0.77073824,
                  0.77073824,
                  0.77073824,
                  0.77073824,
                  1.84003687,
                  1.84003687,
                  1.84003687,
                  1.84003687,
                  1.84003687,
              ],
              [
                  0.78973997,
                  0.78973997,
                  0.78973997,
                  0.78973997,
                  0.78973997,
                  0.78973997,
                  1.87398517,
                  1.87398517,
                  1.87398517,
                  1.87398517,
                  1.87398517,
              ],
          ]
      )
      const_initializer = tf.constant_initializer(0.5)
      cell = NASCell(
          units=units,
          projection=projection,
          kernel_initializer=const_initializer,
          recurrent_initializer=const_initializer,
          projection_initializer=const_initializer,
      )
      inputs = tf.constant(
          np.array(
              [
                  [1.0, 1.0, 1.0, 1.0],
                  [2.0, 2.0, 2.0, 2.0],
                  [3.0, 3.0, 3.0, 3.0],
              ],
              dtype=np.float32,
          ),
          dtype=tf.float32,
      )
      state_value_c = tf.constant(
          0.1 * np.ones((batch_size, units), dtype=np.float32),
          dtype=tf.float32,
      )
      state_value_h = tf.constant(
          0.1 * np.ones((batch_size, projection), dtype=np.float32),
          dtype=tf.float32,
      )
      init_state = [state_value_c, state_value_h]
      output, state = cell(inputs, init_state)
      res = [output, state]
  
      # This is a smoke test: Only making sure expected values not change.
      assert len(res) == 2
      np.testing.assert_allclose(
          res[0], expected_output, rtol=1e-6, atol=1e-6
      )
      # There should be 2 states in the tuple.
      assert len(res[1]) == 2
      # Checking the shape of each state to be batch_size * num_units
      new_c, new_h = res[1]
      assert new_c.shape[0] == batch_size
      assert new_c.shape[1] == units
      assert new_h.shape[0] == batch_size
      assert new_h.shape[1] == projection
      np.testing.assert_allclose(
          np.concatenate(res[1], axis=1),
          expected_state,
          rtol=1e-6,
          atol=1e-6,
      )
  
file_path: addons/tensorflow_addons/rnn/tests/nas_cell_test.py
imports: import numpy
  import tensorflow
  import tensorflow.keras
  from tensorflow_addons.rnn import NASCell
label_desc: Use image node_id 2 for calling a global function with example usage: test_projection() without return types