code: def testComputeAreaFeatures1D(self):
      features = tf.constant(
          [
              [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],
              [
                  [1.1, 2.1],
                  [3.1, 4.1],
                  [5.1, 6.1],
                  [7.1, 8.1],
                  [9.1, 10.1],
              ],
          ],
          dtype=tf.float32,
      )
      (
          area_mean,
          area_std,
          area_sum,
          area_height,
          area_widths,
      ) = area_attention.compute_area_features(
          features, max_area_width=3, epsilon=0.0
      )
      with self.test_session() as session:
          session.run(tf.global_variables_initializer())
          res1, res2, res3, res4, res5 = session.run(
              [area_mean, area_std, area_sum, area_height, area_widths]
          )
      self.assertAllClose(
          (
              (
                  (
                      (1, 2),
                      (3, 4),
                      (5, 6),
                      (7, 8),
                      (9, 10),
                      (2, 3),
                      (4, 5),
                      (6, 7),
                      (8, 9),
                      (3, 4),
                      (5, 6),
                      (7, 8),
                  ),
                  (
                      (1.1, 2.1),
                      (3.1, 4.1),
                      (5.1, 6.1),
                      (7.1, 8.1),
                      (9.1, 10.1),
                      (2.1, 3.1),
                      (4.1, 5.1),
                      (6.1, 7.1),
                      (8.1, 9.1),
                      (3.1, 4.1),
                      (5.1, 6.1),
                      (7.1, 8.1),
                  ),
              )
          ),
          res1,
          msg="mean_1d",
      )
      expected_std = np.array(
          [
              [
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [1, 1],
                  [1, 1],
                  [1, 1],
                  [1, 1],
                  [1.63299, 1.63299],
                  [1.63299, 1.63299],
                  [1.63299, 1.63299],
              ],
              [
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [1, 1],
                  [1, 1],
                  [1, 1],
                  [1, 1],
                  [1.63299, 1.63299],
                  [1.63299, 1.63299],
                  [1.63299, 1.63299],
              ],
          ]
      )
      self.assertAllClose(expected_std, res2, atol=1e-2, msg="std_1d")
      self.assertAllClose(
          [
              [
                  [1, 2],
                  [3, 4],
                  [5, 6],
                  [7, 8],
                  [9, 10],
                  [4, 6],
                  [8, 10],
                  [12, 14],
                  [16, 18],
                  [9, 12],
                  [15, 18],
                  [21, 24],
              ],
              [
                  [1.1, 2.1],
                  [3.1, 4.1],
                  [5.1, 6.1],
                  [7.1, 8.1],
                  [9.1, 10.1],
                  [4.2, 6.2],
                  [8.2, 10.2],
                  [12.2, 14.2],
                  [16.2, 18.2],
                  [9.3, 12.3],
                  [15.3, 18.3],
                  [21.3, 24.3],
              ],
          ],
          res3,
          msg="sum_1d",
      )
      self.assertAllEqual(
          [
              [
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
              ],
              [
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
              ],
          ],
          res4,
          msg="height_1d",
      )
      self.assertAllEqual(
          [
              [
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [2],
                  [2],
                  [2],
                  [2],
                  [3],
                  [3],
                  [3],
              ],
              [
                  [1],
                  [1],
                  [1],
                  [1],
                  [1],
                  [2],
                  [2],
                  [2],
                  [2],
                  [3],
                  [3],
                  [3],
              ],
          ],
          res5,
          msg="width_1d",
      )
  
file_path: tensor2tensor/tensor2tensor/layers/area_attention_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  from tensor2tensor.layers import area_attention
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the AreaAttentionTest obj's underlying member method code with example usage: obj.testComputeAreaFeatures1D() without return types