docstr: Check that the padding remover is working correctly.
docstr_tok: ["Check","that","the","padding","remover","is","working","correctly","."]
code: def testPadRemover(self):
      """Check that the padding remover is working correctly."""
      x_1 = tf.constant(
          [
              [1, 2, 3],
              [4, 5, 6],
              [7, 8, 9],
              [0, 0, 0],  # pad
              [0, 0, 0],  # pad
              [0, 0, 0],  # pad
              [10, 11, 12],
              [13, 14, 15],
              [0, 0, 0],  # pad
          ],
          dtype=tf.float32,
      )
      # Get padding mask
      x_pad_mask = common_attention.embedding_to_padding(x_1)
      x_2 = tf.constant(
          [
              [1],
              [2],
              [3],
              [4],  # pad
              [5],  # pad
              [6],  # pad
              [7],
              [8],
              [9],  # pad
          ],
          dtype=tf.float32,
      )
      x_3 = tf.constant(
          [
              1,
              2,
              3,
              4,  # pad
              5,  # pad
              6,  # pad
              7,
              8,
              9,  # pad
          ],
          dtype=tf.float32,
      )
  
      pad_remover = expert_utils.PadRemover(x_pad_mask)
  
      y_1 = pad_remover.remove(x_1)
      y_2 = pad_remover.remove(x_2)
      y_3 = pad_remover.remove(x_3)
  
      z_1 = pad_remover.restore(y_1 * 2)
      z_2 = pad_remover.restore(y_2 * 2)
      z_3 = pad_remover.restore(y_3 * 2)
  
      with self.test_session() as sess:
          # Padding should have been removed
          self._verify_value(
              sess,
              y_1,
              [
                  [1.0, 2.0, 3.0],
                  [4.0, 5.0, 6.0],
                  [7.0, 8.0, 9.0],
                  [10.0, 11.0, 12.0],
                  [13.0, 14.0, 15.0],
              ],
          )
          self._verify_value(
              sess,
              y_2,
              [
                  [1.0],
                  [2.0],
                  [3.0],
                  [7.0],
                  [8.0],
              ],
          )
          self._verify_value(
              sess,
              y_3,
              [
                  1.0,
                  2.0,
                  3.0,
                  7.0,
                  8.0,
              ],
          )
  
          # Padding should have been restored
          self._verify_value(
              sess,
              z_1,
              [
                  [2.0, 4.0, 6.0],
                  [8.0, 10.0, 12.0],
                  [14.0, 16, 18.0],
                  [0.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0],
                  [20.0, 22.0, 24.0],
                  [26.0, 28.0, 30.0],
                  [0.0, 0.0, 0.0],
              ],
          )
          self._verify_value(
              sess,
              z_2,
              [
                  [2.0],
                  [4.0],
                  [6.0],
                  [0.0],  # pad
                  [0.0],  # pad
                  [0.0],  # pad
                  [14.0],
                  [16.0],
                  [0.0],  # pad
              ],
          )
          self._verify_value(
              sess,
              z_3,
              [
                  2.0,
                  4.0,
                  6.0,
                  0.0,  # pad
                  0.0,  # pad
                  0.0,  # pad
                  14.0,
                  16.0,
                  0.0,  # pad
              ],
          )
  
file_path: tensor2tensor/tensor2tensor/utils/expert_utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_attention
  from tensor2tensor.utils import expert_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the ExpertUtilsTest obj's underlying member method code with example usage: obj.testPadRemover() without return types