code: def testAverageWrongShape(self):
      with self.assertRaisesWithPredicateMatch(
          tf.errors.InvalidArgumentError, r""
      ):
          math_ops.average(np.ones([2, 3]), weights=np.ones([2, 4]))
      with self.assertRaisesWithPredicateMatch(
          tf.errors.InvalidArgumentError, r""
      ):
          math_ops.average(
              np.ones([2, 3]), axis=0, weights=np.ones([2, 4])
          )
      with self.assertRaisesWithPredicateMatch(
          tf.errors.InvalidArgumentError, r""
      ):
          math_ops.average(np.ones([2, 3]), axis=0, weights=np.ones([]))
      with self.assertRaisesWithPredicateMatch(
          tf.errors.InvalidArgumentError, r""
      ):
          math_ops.average(
              np.ones([2, 3]), axis=0, weights=np.ones([5])
          )
  
imports: import itertools
  from absl.testing import parameterized
  import numpy
  from six.moves import range
  import tensorflow.compat.v2
  from trax.tf_numpy.numpy_impl import array_ops
  from trax.tf_numpy.numpy_impl import arrays
  from trax.tf_numpy.numpy_impl import math_ops
label_desc: Use image node_id 17 for calling the MathTest obj's underlying member method code with example usage: obj.testAverageWrongShape() without return types