code: def test_batchnorm_backward_dnnl(self):
      dev = cpu_dev
      N = 1
      C = 3
      H = 2
      W = 2
  
      data_shape = [N, C, H, W]
      param_shape = [1, C, 1, 1]
      data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  
      x_0 = np.array(data, dtype=np.float32).reshape(data_shape)
      y_0 = np.array(data, dtype=np.float32).reshape(data_shape)
      dy_0 = np.array(data, dtype=np.float32).reshape(data_shape)
      scale_0 = np.array([1] * C, dtype=np.float32).reshape(param_shape)
      bias_0 = np.array([0] * C, dtype=np.float32).reshape(param_shape)
  
      mean_0 = x_0.mean(axis=(0, 2, 3), keepdims=True)
      var_0 = x_0.var(axis=(0, 2, 3), keepdims=True)
  
      hndl = singa_api.BatchNormHandle(
          0.1, tensor.Tensor(device=dev, data=x_0).data
      )
      (dx_2_c, _, _) = singa_api.CpuBatchNormBackwardx(
          hndl,
          tensor.Tensor(device=dev, data=y_0).data,
          tensor.Tensor(device=dev, data=dy_0).data,
          tensor.Tensor(device=dev, data=x_0).data,
          tensor.Tensor(device=dev, data=scale_0).data,
          tensor.Tensor(device=dev, data=bias_0).data,
          tensor.Tensor(device=dev, data=mean_0).data,
          tensor.Tensor(device=dev, data=var_0).data,
      )
  
      dx_truth = np.array(
          [
              [
                  [
                      [-1.0769e-05, -3.5985e-06],
                      [3.5985e-06, 1.0769e-05],
                  ],
                  [
                      [-1.0769e-05, -3.5985e-06],
                      [3.5985e-06, 1.0769e-05],
                  ],
                  [
                      [-1.0769e-05, -3.5985e-06],
                      [3.5985e-06, 1.0769e-05],
                  ],
              ]
          ]
      )
      np.testing.assert_array_almost_equal(
          tensor.to_numpy(_cTensor_to_pyTensor(dx_2_c)), dx_truth
      )
  
      return
  
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 16 for calling the TestAPI obj's underlying member method code with example usage: obj.test_batchnorm_backward_dnnl() without return types