code: def testNGramLayerOutput(self):
      inputs = tf.constant(
          [[0, 0, 0, 0, 1], [2, 1, 2, 1, 0]], dtype=tf.int32
      )
      layer = ngram.NGram(3, minval=1, maxval=3)
      outputs = layer(inputs)
      expected_outputs = tf.constant(
          [
              [
                  4.0,
                  1.0,
                  0.0,
                  2.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
              ],
              [
                  1.0,
                  2.0,
                  2.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  2.0,
                  0.0,
              ],
          ],
          dtype=tf.float32,
      )
      outputs_val, expected_outputs_val = self.evaluate(
          [outputs, expected_outputs]
      )
      self.assertAllEqual(outputs_val, expected_outputs_val)
  
file_path: tensor2tensor/tensor2tensor/layers/ngram_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import ngram
  from tensor2tensor.utils import test_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the NGramTest obj's underlying member method code with example usage: obj.testNGramLayerOutput() without return types