code: def test_embedding_and_positional_encodings(
      self, input_vocab_size, output_vocab_size
  ):
      d_model = 16
      max_len = 32
      batch = 2
      input_shape = (batch, max_len)
      output_vocab_size_expected = output_vocab_size or input_vocab_size
      x_out = np.random.randint(
          0, output_vocab_size_expected - 1, input_shape
      )
      if input_vocab_size is None:
          x_in = np.random.uniform(size=list(input_shape) + [2])
      else:
          x_in = np.random.randint(0, input_vocab_size - 1, input_shape)
  
      (
          in_encoder,
          out_encoder,
          output_vocab_size_result,
      ) = ct.EmbeddingAndPositionalEncodings(
          input_vocab_size,
          d_model,
          "train",
          0.1,
          [-2],
          max_len,
          output_vocab_size=output_vocab_size,
          pos_axial_shape=None,
          pos_d_axial_embs=None,
      )
  
      self.assertEqual(
          output_vocab_size_result, output_vocab_size_expected
      )
  
      model_in = tl.Serial(in_encoder)
      model_out = tl.Serial(out_encoder)
  
      model_in.init(shapes.signature(x_in))
      model_out.init(shapes.signature(x_out))
  
      y = model_in(x_in)
      self.assertEqual(y.shape, input_shape + (d_model,))
  
      y = model_out(x_out)
      self.assertEqual(y.shape, input_shape + (d_model,))
  
file_path: trax/trax/models/research/configurable_transformer_test.py
imports: import functools
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  from trax import fastmath
  from trax import layers
  from trax import shapes
  from trax.layers import test_utils
  from trax.models.research import configurable_transformer
label_desc: Use image node_id 9 for calling the ConfigurableTransformerTest obj's underlying member method code with example usage: obj.test_embedding_and_positional_encodings(input_vocab_size, output_vocab_size) without return types