code: def testNGramLayerShape(self):
      batch_size = 2
      length = 8
      vocab_size = 3
      minval = 1
      maxval = 4
      inputs = tf.random_uniform(
          [batch_size, length],
          minval=0,
          maxval=vocab_size,
          dtype=tf.int32,
      )
      layer = ngram.NGram(vocab_size, minval, maxval)
      outputs = layer(inputs)
      outputs_val = self.evaluate(outputs)
      num_ngrams = sum([vocab_size**n for n in range(minval, maxval)])
      self.assertEqual(outputs_val.shape, (batch_size, num_ngrams))
  
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 1 for calling the NGramTest obj's underlying member method code with example usage: obj.testNGramLayerShape() without return types