code: def test_channel_shuffle(
      self, channels_per_group, groups, n, order, gc, dc
  ):
      X = np.round(
          np.random.rand(n, channels_per_group * groups, 5, 6) * 255
      ).astype(np.float32)
      if n != 0:
          X[0, 0, 0, 0] = 0
          X[0, 0, 0, 1] = 255
      if order == "NHWC":
          X = utils.NCHW2NHWC(X)
  
      net = core.Net("test_net")
  
      quantize = core.CreateOperator(
          "Quantize", ["X"], ["X_q"], engine="DNNLOWP"
      )
  
      channel_shuffle = core.CreateOperator(
          "ChannelShuffle",
          ["X_q"],
          ["Y_q"],
          group=groups,
          kernel=1,
          order=order,
          engine="DNNLOWP",
      )
  
      dequantize = core.CreateOperator(
          "Dequantize", ["Y_q"], ["Y"], engine="DNNLOWP"
      )
  
      net.Proto().op.extend([quantize, channel_shuffle, dequantize])
      workspace.FeedBlob("X", X)
      workspace.RunNetOnce(net)
      Y = workspace.FetchBlob("Y")
  
      def channel_shuffle_ref(X):
          if order == "NHWC":
              X = utils.NHWC2NCHW(X)
          Y_r = X.reshape(
              X.shape[0],
              groups,
              X.shape[1] // groups,
              X.shape[2],
              X.shape[3],
          )
          Y_trns = Y_r.transpose((0, 2, 1, 3, 4))
          Y_reshaped = Y_trns.reshape(X.shape)
          if order == "NHWC":
              Y_reshaped = utils.NCHW2NHWC(Y_reshaped)
          return Y_reshaped
  
      Y_ref = channel_shuffle_ref(X)
      np.testing.assert_allclose(Y, Y_ref)
  
file_path: pytorch/caffe2/quantization/server/channel_shuffle_dnnlowp_op_test.py
imports: import caffe2.python.hypothesis_test_util
  import hypothesis.strategies
  import numpy
  from caffe2.python import core, dyndep, utils, workspace
  from hypothesis import given, settings
label_desc: Use image node_id 1 for calling the DNNLowPChannelShuffleOpsTest obj's underlying member method code with example usage: obj.test_channel_shuffle(channels_per_group, groups, n, order, gc, dc) and returns: Y_reshaped