onnxruntime/test/contrib_ops/quantize_linear_test.cc
TEST(DequantizeLinearOpTest, DequantizeLinear_4) {
  OpTester test("DequantizeLinear", 1, onnxruntime::kMSDomain);
  std::vector<int64_t> dims{2, 3, 2, 4};
  test.AddInput<int8_t>("X", dims,
                        {7, 9, 10, 10,
                         5, 8, 9, 1,

                         8, 6, 7, 9,
                         10, 0, 7, 10,

                         8, 2, 6, 0,
                         5, 9, 8, 1,

                         2, 7, 5, 3,
                         2, 4, 1, 3,

                         8, 7, 4, 8,
                         10, 1, 5, 5,

                         7, 7, 0, 2,
                         4, 4, 0, 5});
  test.AddAttribute<int64_t>("axis", 1);
  test.AddInput<float>("scale", {3}, {1, 10, 7});
  test.AddInput<int8_t>("zero_point", {3}, {10, 2, 1});
  test.AddOutput<float>("Y", dims,
                        {-3, -1, 0, 0,
                         -5, -2, -1, -9,

                         60, 40, 50, 70,
                         80, -20, 50, 80,

                         49, 7, 35, -7,
                         28, 56, 49, 0,

                         -8, -3, -5, -7,
                         -8, -6, -9, -7,

                         60, 50, 20, 60,
                         80, -10, 30, 30,

                         42, 42, -7, 7,
                         21, 21, -7, 28});
  test.Run();
}
// 1d zero & scale with int8 broadcast axis 0 with 4d tensor input/output
1d zero & scale with int8 broadcast axis 0 with 4d tensor input/output
1d zero & scale with int8 broadcast axis 0 with 4d tensor input / output
TEST(DequantizeLinearOpTest, DequantizeLinear_4) {
  OpTester test("DequantizeLinear", 1, onnxruntime::kMSDomain);
  std::vector<int64_t> dims{2, 3, 2, 4};
  test.AddInput<int8_t>("X", dims,
                        {7, 9, 10, 10,
                         5, 8, 9, 1,
                         8, 6, 7, 9,
                         10, 0, 7, 10,
                         8, 2, 6, 0,
                         5, 9, 8, 1,
                         2, 7, 5, 3,
                         2, 4, 1, 3,
                         8, 7, 4, 8,
                         10, 1, 5, 5,
                         7, 7, 0, 2,
                         4, 4, 0, 5});
  test.AddAttribute<int64_t>("axis", 1);
  test.AddInput<float>("scale", {3}, {1, 10, 7});
  test.AddInput<int8_t>("zero_point", {3}, {10, 2, 1});
  test.AddOutput<float>("Y", dims,
                        {-3, -1, 0, 0,
                         -5, -2, -1, -9,
                         60, 40, 50, 70,
                         80, -20, 50, 80,
                         49, 7, 35, -7,
                         28, 56, 49, 0,
                         -8, -3, -5, -7,
                         -8, -6, -9, -7,
                         60, 50, 20, 60,
                         80, -10, 30, 30,
                         42, 42, -7, 7,
                         21, 21, -7, 28});
  test.Run();
}
TEST ( DequantizeLinearOpTest , DequantizeLinear_4 ) { OpTester test ( " " , 1 , onnxruntime :: kMSDomain ) ; std :: vector < int64_t > dims { 2 , 3 , 2 , 4 } ; test . AddInput < int8_t > ( " " , dims , { 7 , 9 , 10 , 10 , 5 , 8 , 9 , 1 , 8 , 6 , 7 , 9 , 10 , 0 , 7 , 10 , 8 , 2 , 6 , 0 , 5 , 9 , 8 , 1 , 2 , 7 , 5 , 3 , 2 , 4 , 1 , 3 , 8 , 7 , 4 , 8 , 10 , 1 , 5 , 5 , 7 , 7 , 0 , 2 , 4 , 4 , 0 , 5 } ) ; test . AddAttribute < int64_t > ( " " , 1 ) ; test . AddInput < float > ( " " , { 3 } , { 1 , 10 , 7 } ) ; test . AddInput < int8_t > ( " " , { 3 } , { 10 , 2 , 1 } ) ; test . AddOutput < float > ( " " , dims , { -3 , -1 , 0 , 0 , -5 , -2 , -1 , -9 , 60 , 40 , 50 , 70 , 80 , -20 , 50 , 80 , 49 , 7 , 35 , -7 , 28 , 56 , 49 , 0 , -8 , -3 , -5 , -7 , -8 , -6 , -9 , -7 , 60 , 50 , 20 , 60 , 80 , -10 , 30 , 30 , 42 , 42 , -7 , 7 , 21 , 21 , -7 , 28 } ) ; test . Run ( ) ; }
1d zero & scale with int8 broadcast axis 0 with 4d tensor input/output
1d zero & scale with int8 broadcast axis 0 with 4d tensor input / output