onnxruntime/test/contrib_ops/quantize_linear_test.cc
TEST(QuantizeLinearOpTest, QuantizeLinear_0) {
  OpTester test("QuantizeLinear", 1, onnxruntime::kMSDomain);
  std::vector<int64_t> dims{6};
  test.AddInput<float>("x", dims, {0, 2, 3, 1000, -254, -1000});
  test.AddInput<float>("y_scale", {}, {2.0f});
  test.AddInput<uint8_t>("y_zero_point", {}, {128});
  test.AddOutput<uint8_t>("y", dims, {128, 129, 130, 255, 1, 0});
  test.Run();
}
// quantize with scalar zero point and scale
quantize with scalar zero point and scale
quantize with scalar zero point and scale
TEST(QuantizeLinearOpTest, QuantizeLinear_0) {
  OpTester test("QuantizeLinear", 1, onnxruntime::kMSDomain);
  std::vector<int64_t> dims{6};
  test.AddInput<float>("x", dims, {0, 2, 3, 1000, -254, -1000});
  test.AddInput<float>("y_scale", {}, {2.0f});
  test.AddInput<uint8_t>("y_zero_point", {}, {128});
  test.AddOutput<uint8_t>("y", dims, {128, 129, 130, 255, 1, 0});
  test.Run();
}
TEST ( QuantizeLinearOpTest , QuantizeLinear_0 ) { OpTester test ( " " , 1 , onnxruntime :: kMSDomain ) ; std :: vector < int64_t > dims { 6 } ; test . AddInput < float > ( " " , dims , { 0 , 2 , 3 , 1000 , -254 , -1000 } ) ; test . AddInput < float > ( " " , { } , { 2.0f } ) ; test . AddInput < uint8_t > ( " " , { } , { 128 } ) ; test . AddOutput < uint8_t > ( " " , dims , { 128 , 129 , 130 , 255 , 1 , 0 } ) ; test . Run ( ) ; }
quantize with scalar zero point and scale
quantize with scalar zero point and scale