onnxruntime/test/contrib_ops/quantize_linear_test.cc
TEST(QuantizeLinearOpTest, QuantizeLinear_2) {
  OpTester test("QuantizeLinear", 1, onnxruntime::kMSDomain);
  std::vector<int64_t> dims{3, 4};
  test.AddInput<float>("X", dims,
                       {0, 2, 3, 1000,
                        0, 2, 3, 1000,
                        0, 2, 3, 1000});
  test.AddAttribute<int64_t>("axis", -2);
  test.AddInput<float>("scale", {3}, {1, 2, 4});
  test.AddInput<uint8_t>("zero_point", {3}, {0, 0, 0});
  test.AddOutput<uint8_t>("Y", dims,
                          {0, 2, 3, 255,
                           0, 1, 2, 255,
                           0, 1, 1, 250});
  test.Run();
}
// quantize with broadcasting and negative axis (-2 resolves to axis 0)
quantize with broadcasting and negative axis (-2 resolves to axis 0)
quantize with broadcasting and negative axis ( - 2 resolves to axis 0 )
TEST(QuantizeLinearOpTest, QuantizeLinear_2) {
  OpTester test("QuantizeLinear", 1, onnxruntime::kMSDomain);
  std::vector<int64_t> dims{3, 4};
  test.AddInput<float>("X", dims,
                       {0, 2, 3, 1000,
                        0, 2, 3, 1000,
                        0, 2, 3, 1000});
  test.AddAttribute<int64_t>("axis", -2);
  test.AddInput<float>("scale", {3}, {1, 2, 4});
  test.AddInput<uint8_t>("zero_point", {3}, {0, 0, 0});
  test.AddOutput<uint8_t>("Y", dims,
                          {0, 2, 3, 255,
                           0, 1, 2, 255,
                           0, 1, 1, 250});
  test.Run();
}
TEST ( QuantizeLinearOpTest , QuantizeLinear_2 ) { OpTester test ( " " , 1 , onnxruntime :: kMSDomain ) ; std :: vector < int64_t > dims { 3 , 4 } ; test . AddInput < float > ( " " , dims , { 0 , 2 , 3 , 1000 , 0 , 2 , 3 , 1000 , 0 , 2 , 3 , 1000 } ) ; test . AddAttribute < int64_t > ( " " , -2 ) ; test . AddInput < float > ( " " , { 3 } , { 1 , 2 , 4 } ) ; test . AddInput < uint8_t > ( " " , { 3 } , { 0 , 0 , 0 } ) ; test . AddOutput < uint8_t > ( " " , dims , { 0 , 2 , 3 , 255 , 0 , 1 , 2 , 255 , 0 , 1 , 1 , 250 } ) ; test . Run ( ) ; }
quantize with broadcasting and negative axis (-2 resolves to axis 0)
quantize with broadcasting and negative axis ( - 2 resolves to axis 0 )