code: def _transpose_and_arithmetic_op_broadcast_helper(self, dev):
      def _test(s1, s2, axis1, axis2, s3, s_op, n_op, dev):
          x_0 = np.random.random(s1).astype(np.float32)
          y_0 = np.random.random(s2).astype(np.float32)
  
          x0 = tensor.Tensor(device=dev, data=x_0)
          y0 = tensor.Tensor(device=dev, data=y_0)
  
          x1 = x0.transpose(axis1)
          y1 = y0.transpose(axis2)
  
          z0 = tensor._call_singa_func(s_op, x1.data, y1.data)
          z0.to_host()
  
          np.testing.assert_array_almost_equal(
              tensor.to_numpy(z0),
              n_op(x_0.transpose(axis1), y_0.transpose(axis2)),
          )
          np.testing.assert_array_almost_equal(z0.shape, s3)
          return
  
      for s_op, n_op in zip(
          [
              singa_api.Pow,
              singa_api.__add__,
              singa_api.__div__,
              singa_api.__sub__,
              singa_api.__mul__,
          ],
          [np.power, np.add, np.divide, np.subtract, np.multiply],
      ):
          s1 = [1, 5, 1, 3]
          s2 = [3, 1, 1, 4]
          axis1 = [3, 2, 1, 0]  # 3121
          axis2 = [1, 0, 2, 3]  # 1314
          s3 = [3, 3, 5, 4]
          _test(s1, s2, axis1, axis2, s3, s_op, n_op, dev)
  
          s1 = [1, 5, 1]
          s2 = [1, 3, 2]
          axis1 = [2, 1, 0]  # 151
          axis2 = [1, 0, 2]  # 312
          s3 = [3, 5, 2]
          _test(s1, s2, axis1, axis2, s3, s_op, n_op, dev)
  
          s1 = [5, 1]
          s2 = [1, 3]
          axis1 = [1, 0]  # 15
          axis2 = [1, 0]  # 31
          s3 = [3, 5]
          _test(s1, s2, axis1, axis2, s3, s_op, n_op, dev)
  
imports: from __future__ import division
  import unittest
  import math
  import numpy
  from singa import singa_wrap
  from singa import tensor
  from cuda_helper import gpu_dev, cpu_dev
label_desc: Use image node_id 9 for calling the TestAPI obj's underlying member method code with example usage: obj._transpose_and_arithmetic_op_broadcast_helper(dev) without return types