text: // Copyright (c) Microsoft Corporation. All rights reserved.
  // Licensed under the MIT License.
  
  #include "gtest/gtest.h"
  #include "test/providers/provider_test_utils.h"
  
  namespace onnxruntime {
  namespace test {
  
  /**
   *  Equivalent Python implementation:
   *
   *  import numpy as np
      def qlinearmatmul(a, ascale, azero, b, bscale, bzero, yscale, yzero):
        q_a = (a.astype(int) - azero).astype(float)*ascale
        q_b = (b.astype(int) - bzero).astype(float)*bscale
        #print(q_a @ q_b)                              
        return (((q_a @ q_b) / yscale).astype(int) + yzero)   
  
      a =  np.random.randint(low=-4,high=4,size=(16,16),dtype=np.int8)
      print(np.array2string(a.flatten(), separator=','))
  
      a_scale = np.array([1], dtype=np.float32)
      a_zero_point = np.array([0], dtype=np.int8)
  
  
      b = np.random.randint(low=-4,high=4,size=(16,16),dtype=np.int8)
      print(np.array2string(b.flatten(), separator=','))
  
      b_scale = np.array([1], dtype=np.float32)
      b_zero_point = np.array([0], dtype=np.int8)
  
      y_scale = np.array([1], dtype=np.float32)
      y_zero_point = np.array([0], dtype=np.int8)
  
      res = qlinearmatmul(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point)
      print(np.array2string(res.flatten(), separator=','))
   */
  
  TEST(QuantizeLinearMatmulOpTest, QLinearMatMul3D) {
    OpTester test("QLinearMatMul", 10);
    test.AddInput<uint8_t>("T1", {2, 2, 4},
                           {208, 236, 0, 238,
                            3, 214, 255, 29,
                            
                            208, 236, 0, 238,
                            3, 214, 255, 29});
  
    test.AddInput<float>("a_scale", {}, {0.0066f});
    test.AddInput<uint8_t>("a_zero_point", {}, {113});
  
    test.AddInput<uint8_t>("T2", {2, 4, 3},
                           {152, 51, 244,
                            60, 26, 255, 
                            0, 127, 246, 
                            127, 254, 247,
  
                            152, 51, 244,
                            60, 26, 255,
                            0, 127, 246,
                            127, 254, 247});
      
    test.AddInput<float>("b_scale", {}, {0.00705f});
    test.AddInput<uint8_t>("b_zero_point", {}, {114});
  
    test.AddInput<float>("y_scale", {}, {0.0107f});
    test.AddInput<uint8_t>("y_zero_point", {}, {118});
    test.AddOutput<uint8_t>("T3", {2, 2, 3}, 
                            {168, 115, 255,
                             1, 66, 151,
  
                             168, 115, 255,
                             1, 66, 151});
                             
    test.Run();
  }
  
  TEST(QuantizeLinearMatmulOpTest, QLinearMatMul) {
    OpTester test("QLinearMatMul", 10);
    test.AddInput<uint8_t>("T1", {2, 4}, {208, 236, 0, 238, 3, 214, 255, 29});
    test.AddInput<float>("a_scale", {}, {0.0066f});
    test.AddInput<uint8_t>("a_zero_point", {}, {113});
    test.AddInput<uint8_t>("T2", {4, 3}, {152, 51, 244, 60, 26, 255, 0, 127, 246, 127, 254, 247});
    test.AddInput<float>("b_scale", {}, {0.00705f});
    test.AddInput<uint8_t>("b_zero_point", {}, {114});
    test.AddInput<float>("y_scale", {}, {0.0107f});
    test.AddInput<uint8_t>("y_zero_point", {}, {118});
    test.AddOutput<uint8_t>("T3", {2, 3}, {168, 115, 255, 1, 66, 151});
    test.Run();
  }
  
  TEST(QuantizeLinearMatmulOpTest, QLinearMatMulInt8) {
    OpTester test("QLinearMatMul", 10);
    test.AddInput<int8_t>("T1", {16, 16}, {-4, -3, 1, -4, 3, 2, -3, 2, -1, -2, -2, 1, -1, -2, 2, -2, 3, 1, -1, \
                                            2, -4, 2, 2, -4, 1, 1, 2, 1, 0, -2, 3, 3, -4, -1, 3, -3, 2, -1, -1, \
                                            2, -3, -4, 0, 3, -2, -2, 3, 0, -2, -3, 2, -3, -1, -3, -3, 0, 0, -3, \
                                            2, 1, 1, 3, 2, -4, 2, -2, -3, -3, 0, -3, -4, -2, 0, 0, 2, -2, 0, -3, \
                                            0, 1, 3, -1, -4, -1, 0, -2, 3, 3, -4, -3, -1, 1, 3, 1, -2, 3, 0, -2, \
                                            2, -3, 1, 2, 1, 3, 3, -4, 2, -2, -2, -4, 2, 2, 2, -2, -2, -2, 3, -3, \
                                            -2, 0, 1, 1, 0, -3, -3, -1, -3, -1, -4, 0, -2, -1, -3, 1, -2, 2, 0, \
                                            1, -1, 1, 0, 1, 0, 1, 3, 2, -2, -1, -2, 0, -3, 1, 2, -2, 3, 0, 2, 0, \
                                            1, 1, 2, -1, -1, -4, -1, -3, -3, -3, -2, -3, -3, -2, 2, 3, -1, 3, 3, \
                                            -3, -4, -4, -4, -3, 0, -1, -4, -3, -3, -2, 3, 0, -1, 0, -1, -3, -4, \
                                            -4, 1, -3, 3, -4, -1, 3, 0, 3, -2, -2, -2, -4, 3, 2, -4, 0, -4, -1, \
                                            -1, 3, -1, 1, -3, 3, 1, -4, 3, 1, -1, 1, 1, 1, 2, 1, -3, -2, 0, 1, \
                                            -1, -3, -2, -2, -1, 0, 1, 1, 1, -2, 0, -2, 3, 0, -1, 0, -3, -1, -2, \
                                            -4, 3, 2});
    test.AddInput<float>("a_scale", {}, {1.0f});
    test.AddInput<int8_t>("a_zero_point", {}, {0});
    test.AddInput<int8_t>("T2", {16, 16}, {2, 2, -4, -3, 2, 3, 1, 0, 0, 0, 1, -3, -3, -1, -3, 3, 3, -1, 2, 1, \
                                          1, 3, -1, 0, 0, 0, -3, 1, 2, 0, 0, 3, 1, 2, -2, 3, 2, -4, -3, 0, 0, \
                                          -2, 3, -2, -4, 2, 2, 0, -3, 3, -3, 1, -2, -4, -2, -4, 0, 0, 3, 0, -2, \
                                          0, 3, 0, -3, -4, 1, 1, 1, -2, 0, 2, 2, 0, 1, -2, -2, -1, -2, 2, -3, \
                                          -4, 2, 3, -3, -1, 0, 0, -4, -2, -3, 0, 0, -3, -2, -3, -2, -2, 3, 3, \
                                          0, -4, -3, 2, 3, 3, 1, -2, 3, -4, -2, 3, -2, -2, 0, 0, -1, -4, 2, -2, \
                                          -2, 0, -4, 3, -1, 2, 3, -3, -1, 0, -1, 1, -1, 2, 2, 1, -4, 1, 0, -1, \
                                          0, 2, 2, 3, -1, -1, 3, 3, -2, 2, -4, 3, -4, -4, -4, -1, 1, -1, -3, \
                                          -3, 0, 1, 3, -1, -4, -4, 1, -1, -4, 1, -2, -1, 0, 3, -3, 2, -3, 0, \
                                          -2, -3, 3, 2, -4, -1, 1, 3, 0, 3, 2, 3, 1, 2, -3, -2, -2, -4, -3, -4, \
                                          -1, 2, -2, 1, 3, 2, -3, 3, 3, 0, 0, -1, 1, -1, -3, 1, 1, 0, 0, 0, -1, \
                                          0, 1, -2, -2, -2, 1, -2, -3, -3, 3, -1, 1, -4, -2, 2, -1, -3, 2, -2, \
                                          -4, 1, -3, -2, -2, 0, 0, 3, 2, 0, 3, -3, 1, -1, 3, -4, 0, -1});
    test.AddInput<float>("b_scale", {}, {1.0f});
    test.AddInput<int8_t>("b_zero_point", {}, {0});
    test.AddInput<float>("y_scale", {}, {1.0f});
    test.AddInput<int8_t>("y_zero_point", {}, {0});
    test.AddOutput<int8_t>("T3", {16, 16}, {-6, -29, 3, 0, 25, -15, 14, -4, -2, 2, -11, 15, -8, 15, 8, -27, 1, \
                                            12, -19, -9, 2, 24, -10, -15, -14, 3, 5, -27, 27, -27, -31, 26, 3, \
                                            -12, -8, -10, 47, -27, 2, -24, 30, 19, 4, 12, 7, 18, 10, -1, 27, 20, \
                                            -11, -40, 6, -21, 16, -14, -12, 27, 11, 11, -18, 49, 8, -2, 28, 18, \
                                            -10, -34, 8, 39, 36, 8, -3, -7, 3, -9, -6, 15, -15, 8, -20, -15, -13, \
                                            -42, 1, -4, 16, 5, 51, 21, 15, 21, 9, -17, 7, 2, -3, -17, -6, 12, 15, \
                                            -28, 41, -11, -9, 6, -3, -20, -4, -1, 0, 13, 22, 14, 13, 7, 5, 30, \
                                            27, 23, 10, -14, -4, -13, -16, 3, -11, 3, -8, -12, 13, -1, -16, 17, \
                                            8, -7, -16, -9, -31, 34, 27, 5, 18, -39, 15, 6, -20, -43, -10, 21, \
                                            36, -15, -30, 9, -13, 7, -4, 24, 0, 17, 31, 8, -28, -43, 16, 55, 36, \
                                            16, 44, -9, 32, 0, -3, -14, 1, -7, 31, 15, -21, -54, 13, 30, 29, 12, \
                                            40, 14, 25, 14, 0, -9, 3, -10, 10, 6, 42, 0, 19, 31, -31, 41, 22, 25, \
                                            -5, 1, 29, 3, -33, 20, 7, 2, -37, -42, 34, 42, 1, -24, -3, 12, -22, \
                                            24, 22, 4, 10, 2, 13, 6, 7, 30, 2, 14, 4, 5, -2, -31, 1, -12, -15, -7,
                                              1, -10, 19, -6, -12, 10, 52, 15, -4, 1, 36, 2, 7, -24, 20, -31, \
                                            -13, 19});
    test.Run();
  }
  
  TEST(QuantizeLinearMatmulOpTest, QLinearMatMulInt8WithShift) {
    OpTester test("QLinearMatMul", 10);
    test.AddInput<int8_t>("T1", {16, 32}, {-9, -4, -5, 4, -9, -4, -2, -3, -5, -4, 7, 9, -5, 0, -10, -4, -1, -1, \
                                          -8, -8, -2, 6, -7, -2, -9, 1, -1, -2, 6, -1, -1, -9, 8, 8, 9, 5, -1, \
                                          -5, 4, 1, -2, -5, -2, -9, -1, -1, 9, -6, -7, 3, 2, -2, -5, 7, -7, 3, \
                                          -9, 4, 8, -7, -8, -9, 6, -5, -3, 7, 8, 1, 3, 7, 8, 7, -8, 9, 6, -8, \
                                          -2, 9, -10, -4, 1, -2, -1, 2, -7, -8, -10, 9, -6, -1, -3, 8, -4, 1, \
                                          -1, -4, -2, 0, -4, 2, 9, -6, -6, -7, 4, -6, 8, -6, 9, 0, 9, 0, 9, -5, \
                                          -4, -9, 6, -4, 0, -2, -9, -9, -4, 7, -1, 0, -8, -2, -7, -8, -9, -1, \
                                          1, -7, -7, 0, 2, 7, 7, 6, -6, 1, 5, 8, -1, 3, -1, 0, -5, 8, -7, 9, \
                                          -7, -1, -10, 1, 8, 7, -9, 2, 9, -1, -2, 8, 5, -2, 7, 0, -3, 1, -3, 4, \
                                          -4, 9, -4, -7, -10, 5, -4, -3, -1, 3, -10, 8, 2, -10, -3, -9, -9, 6, \
                                          -3, -2, -4, -10, -10, -6, -4, -4, -10, 5, -8, -8, 1, -2, 1, -3, -5, \
                                          5, -6, 0, -5, -2, 5, 7, -4, 1, 0, -5, -8, -7, 9, -1, 3, -6, -2, -4, \
                                          6, -9, 4, -6, 7, 7, -6, 8, -8, 7, -3, -10, 7, -8, 7, 3, 0, 9, -4, 7, \
                                          -5, -10, 5, -9, -1, 6, -10, -1, -7, 6, 8, -2, 1, 2, 4, -4, -2, 0, -4, \
                                          6, 9, 8, -9, -4, 7, 9, 7, -5, -6, -6, 8, -5, 2, 3, -8, 2, 2, 0, 2, 1, \
                                          -1, -10, -5, 6, 2, 0, -1, -6, 5, 3, 7, -3, -1, -10, -1, -10, -4, -8, \
                                          -5, 8, 0, 3, -5, -2, -6, 8, -7, 6, -8, -5, -7, -3, 6, -2, -7, 4, -10, \
                                          -1, 6, 3, -9, 1, -5, -5, -3, 4, 4, 0, 7, 0, 9, -1, -9, -8, -1, -2, \
                                          -10, 2, 7, 1, 0, -6, -4, 1, -1, -8, 2, 5, -10, -8, -3, 7, -1, 1, 5, \
                                          4, 0, 4, -9, -3, 0, -9, -3, 6, 5, -2, -4, -3, -8, 6, -9, 7, -8, 8, \
                                          -8, 3, -8, 9, 2, 5, 6, -8, 4, 9, -4, -1, -3, 0, 6, -1, 0, -8, -2, -3, \
                                          -3, 3, 0, -10, 4, -5, 2, -7, 6, -8, 5, -9, 3, -3, 7, -10, 3, -10, 1, \
                                          -6, -7, -9, 7, -1, 8, 3, 8, 7, 5, -6, -3, 2, 6, 1, -9, 3, -4, 8, -5, \
                                          -7, -3, -8, -1, 0, -4, 4, -5, 9, 0, -3, -6, -3, 6, -5, -4, -4, 7, 6, \
                                          -3, 2, -8, 8, -8, 5, -3, -1, -3, 9, 6, -9, -7, 6, -10, 1, -6, 8, 8, \
                                          5, 4, -2, -4, -6, -1, -9, -8, 0, -6, 1, 8, 4, 9, 7, -5, -3, 0, -5, \
                                          -3, -6, -5, 9, 5, 9, -4, 1, 5, 9, -5, 6, 7, 2, 6, -10});
    test.AddInput<float>("a_scale", {}, {1.0f});
    test.AddInput<int8_t>("a_zero_point", {}, {0});
    test.AddInput<int8_t>("T2", {32, 16}, {8, 9, -8, 6, -4, 8, 8, -5, 5, 8, -10, -2, -4, -8, 2, -5, -1, -9, 7, \
                                          -3, 9, 3, 1, 6, -6, -2, 1, -1, -8, 6, -4, -1, 5, 7, 0, -7, -8, 6, 3, \
                                          5, -8, -9, 2, 8, 9, 9, 6, 1, -10, -4, -3, 8, 3, -1, -10, -4, -1, -6, \
                                          9, -8, 8, -3, 0, 9, 3, -9, -5, 7, 8, -5, -9, 4, 6, -1, 7, -5, 1, 1, \
                                          1, -10, -8, -1, 0, 7, -1, -3, -5, 9, -6, 9, 1, 1, 0, 8, 6, 3, 5, -10, \
                                          -1, 7, 6, 2, -6, -4, -3, -1, -6, 3, -9, 3, -3, 3, 8, 1, 2, -5, 4, 7, \
                                          -9, 4, 6, 4, -9, -10, -7, -9, 8, 2, -8, 1, 0, -3, 9, -8, 6, -2, -5, \
                                          4, 9, 7, -3, 4, -8, -1, -2, 0, -7, 6, -7, 3, -4, 6, 0, -2, 7, 8, 0, \
                                          -9, -1, 6, -9, 9, 7, 6, -8, -5, -6, -3, 3, 1, -5, 1, -2, -1, 7, 0, \
                                          -6, -9, 2, 4, -9, 9, -4, -9, -8, -9, 8, -3, -5, -6, -2, 6, -6, -8, \
                                          -1, 8, 0, -2, -2, 1, 7, 4, -1, -10, -7, -1, 8, 9, 3, 5, 5, -3, 1, 0, \
                                          -4, -2, 9, 6, 3, 6, -6, 4, -7, 2, 8, 6, 5, 8, 0, 8, -5, 4, -7, -1, \
                                          -1, 7, -6, 2, -2, -1, -6, 5, 0, -5, 3, -7, -4, 6, -5, -8, -5, -10, \
                                          -2, 2, -3, 5, -9, 3, 4, 4, -10, 7, -10, 3, 3, 6, 3, -5, 8, -5, 4, \
                                          -10, 2, -8, 3, -3, -1, 5, 6, -5, -7, 1, -10, -10, -9, 1, 1, 4, -6, 7, \
                                          -3, -4, -7, 2, -5, -1, -6, -2, -3, -5, -10, 3, 7, 7, 5, -7, -1, 1, \
                                          -10, -9, 6, 7, 8, 0, 4, -6, 9, 0, 4, -3, -4, 8, 8, -5, 9, 9, -2, -1, \
                                          9, -7, 8, -4, -9, 3, 9, 8, -10, 4, -5, 4, -8, 1, -1, 9, 4, 9, -8, 3, \
                                          8, -5, 7, 9, 5, 3, -9, 2, -2, -5, -2, 2, -6, 5, -7, 3, -9, 7, 7, 7, \
                                          4, -3, 6, -7, -2, -8, 7, -7, -8, -2, -3, 8, 4, 0, 0, 4, 5, 2, 6, -9, \
                                          4, 3, 3, -6, -5, 3, 5, -2, 6, 9, 5, -10, -5, -1, 6, -2, 4, 1, -7, 6, \
                                          3, -10, -7, -2, -1, -2, -5, -1, 7, 9, 5, 0, 6, -2, -8, 2, -8, 6, 2, \
                                          4, -1, 7, -4, -9, 6, -3, 5, -9, -8, -4, -9, 3, 1, -4, -5, 8, 5, -7, \
                                          9, 9, -8, 8, 6, 8, 4, -8, -7, 6, -2, -5, 2, 9, -1, 2, 6, 5, 6, -5, 6, \
                                          3, 6, -10, 6, -6, 2, 6, -9, -10, -3, 8, 3, -7, -6, -7, -4, 8, -9, 5, \
                                          -2, 5, -8, 6, -10, 1, 5, -3, 3, -5, -6, 5, 3, -8, -2, 1, -4, -10, \
                                          -10, 2, 5, 8, 0, -7, -4, -10});
    test.AddInput<float>("b_scale", {}, {1.0f});
    test.AddInput<int8_t>("b_zero_point", {}, {0});
    test.AddInput<float>("y_scale", {}, {32.0f});
    test.AddInput<int8_t>("y_zero_point", {}, {0});
    test.AddOutput<int8_t>("T3", {16, 16}, {-12, -2, 3, 5, -3, -1, -1, -3, 6, -6, 0, 1, 6, -6, -4, 9, 8, 1, -5, \
                                            3, 1, 11, 5, 5, -4, 1, -10, 4, 1, 0, -7, -1, 7, -10, 3, -3, -4, -4, \
                                            -4, 4, 6, -2, -2, 4, 6, -2, 1, 1, -4, 5, 3, 5, 5, -4, -6, -2, 11, 0, \
                                            8, 0, -2, -1, 2, 1, -8, 2, 4, 1, -5, -11, 1, -4, 4, -7, 0, 2, 3, -11, \
                                            -4, 8, 10, -10, -4, 3, 6, 4, 13, -16, 5, 5, 2, -4, -1, -1, -8, -2, \
                                            -5, 4, 0, 0, 1, -4, 8, 1, 12, 1, -7, -8, 3, -5, 6, 6, 14, -7, -6, -3, \
                                            -13, 15, 0, 0, 1, 2, 4, -1, 7, -10, 4, -8, 0, 9, 2, 9, -2, 5, -8, 2, \
                                            3, -10, 0, 0, -2, -6, 0, 2, 2, -15, -2, -4, 4, -2, 13, -1, -2, -3, \
                                            -8, -2, 2, -2, -6, -1, -2, -8, 9, 4, 9, 5, -2, 0, 5, 2, 6, -11, 3, 1, \
                                            -5, -10, 1, -8, 4, -8, -2, 1, 6, -8, -3, 0, -3, 5, -7, -10, -8, 0, 0, \
                                            4, -2, 6, 4, 7, 3, 5, -6, 5, -1, -2, -5, 12, 7, -5, -4, 1, -3, 3, \
                                            -10, 0, 6, -9, 4, 5, 0, 1, 4, -11, -2, -4, -1, -6, 3, -4, 2, -13, 4, \
                                            0, 9, -9, 7, 4, 2, -6, -6, 1, -6, 3, 6, 0, -10, -4, 4, 8, 7, -3, -1, \
                                            8, 10, -4, 7, 5});
    test.Run();
  }
  
  TEST(QuantizeLinearMatmulOpTest, QLinearMatMulInt8WithRoundedShift) {
    OpTester test("QLinearMatMul", 10);
    test.AddInput<int8_t>("T1", {16, 32}, {-9, -4, -5, 4, -9, -4, -2, -3, -5, -4, 7, 9, -5, 0, -10, -4, -1, -1, \
                                          -8, -8, -2, 6, -7, -2, -9, 1, -1, -2, 6, -1, -1, -9, 8, 8, 9, 5, -1, \
                                          -5, 4, 1, -2, -5, -2, -9, -1, -1, 9, -6, -7, 3, 2, -2, -5, 7, -7, 3, \
                                          -9, 4, 8, -7, -8, -9, 6, -5, -3, 7, 8, 1, 3, 7, 8, 7, -8, 9, 6, -8, \
                                          -2, 9, -10, -4, 1, -2, -1, 2, -7, -8, -10, 9, -6, -1, -3, 8, -4, 1, \
                                          -1, -4, -2, 0, -4, 2, 9, -6, -6, -7, 4, -6, 8, -6, 9, 0, 9, 0, 9, -5, \
                                          -4, -9, 6, -4, 0, -2, -9, -9, -4, 7, -1, 0, -8, -2, -7, -8, -9, -1, \
                                          1, -7, -7, 0, 2, 7, 7, 6, -6, 1, 5, 8, -1, 3, -1, 0, -5, 8, -7, 9, \
                                          -7, -1, -10, 1, 8, 7, -9, 2, 9, -1, -2, 8, 5, -2, 7, 0, -3, 1, -3, 4, \
                                          -4, 9, -4, -7, -10, 5, -4, -3, -1, 3, -10, 8, 2, -10, -3, -9, -9, 6, \
                                          -3, -2, -4, -10, -10, -6, -4, -4, -10, 5, -8, -8, 1, -2, 1, -3, -5, \
                                          5, -6, 0, -5, -2, 5, 7, -4, 1, 0, -5, -8, -7, 9, -1, 3, -6, -2, -4, \
                                          6, -9, 4, -6, 7, 7, -6, 8, -8, 7, -3, -10, 7, -8, 7, 3, 0, 9, -4, 7, \
                                          -5, -10, 5, -9, -1, 6, -10, -1, -7, 6, 8, -2, 1, 2, 4, -4, -2, 0, -4, \
                                          6, 9, 8, -9, -4, 7, 9, 7, -5, -6, -6, 8, -5, 2, 3, -8, 2, 2, 0, 2, 1, \
                                          -1, -10, -5, 6, 2, 0, -1, -6, 5, 3, 7, -3, -1, -10, -1, -10, -4, -8, \
                                          -5, 8, 0, 3, -5, -2, -6, 8, -7, 6, -8, -5, -7, -3, 6, -2, -7, 4, -10, \
                                          -1, 6, 3, -9, 1, -5, -5, -3, 4, 4, 0, 7, 0, 9, -1, -9, -8, -1, -2, \
                                          -10, 2, 7, 1, 0, -6, -4, 1, -1, -8, 2, 5, -10, -8, -3, 7, -1, 1, 5, \
                                          4, 0, 4, -9, -3, 0, -9, -3, 6, 5, -2, -4, -3, -8, 6, -9, 7, -8, 8, \
                                          -8, 3, -8, 9, 2, 5, 6, -8, 4, 9, -4, -1, -3, 0, 6, -1, 0, -8, -2, -3, \
                                          -3, 3, 0, -10, 4, -5, 2, -7, 6, -8, 5, -9, 3, -3, 7, -10, 3, -10, 1, \
                                          -6, -7, -9, 7, -1, 8, 3, 8, 7, 5, -6, -3, 2, 6, 1, -9, 3, -4, 8, -5, \
                                          -7, -3, -8, -1, 0, -4, 4, -5, 9, 0, -3, -6, -3, 6, -5, -4, -4, 7, 6, \
                                          -3, 2, -8, 8, -8, 5, -3, -1, -3, 9, 6, -9, -7, 6, -10, 1, -6, 8, 8, \
                                          5, 4, -2, -4, -6, -1, -9, -8, 0, -6, 1, 8, 4, 9, 7, -5, -3, 0, -5, \
                                          -3, -6, -5, 9, 5, 9, -4, 1, 5, 9, -5, 6, 7, 2, 6, -10});
    test.AddInput<float>("a_scale", {}, {1.0f});
    test.AddInput<int8_t>("a_zero_point", {}, {0});
    test.AddInput<int8_t>("T2", {32, 16}, {8, 9, -8, 6, -4, 8, 8, -5, 5, 8, -10, -2, -4, -8, 2, -5, -1, -9, 7, \
                                          -3, 9, 3, 1, 6, -6, -2, 1, -1, -8, 6, -4, -1, 5, 7, 0, -7, -8, 6, 3, \
                                          5, -8, -9, 2, 8, 9, 9, 6, 1, -10, -4, -3, 8, 3, -1, -10, -4, -1, -6, \
                                          9, -8, 8, -3, 0, 9, 3, -9, -5, 7, 8, -5, -9, 4, 6, -1, 7, -5, 1, 1, \
                                          1, -10, -8, -1, 0, 7, -1, -3, -5, 9, -6, 9, 1, 1, 0, 8, 6, 3, 5, -10, \
                                          -1, 7, 6, 2, -6, -4, -3, -1, -6, 3, -9, 3, -3, 3, 8, 1, 2, -5, 4, 7, \
                                          -9, 4, 6, 4, -9, -10, -7, -9, 8, 2, -8, 1, 0, -3, 9, -8, 6, -2, -5, \
                                          4, 9, 7, -3, 4, -8, -1, -2, 0, -7, 6, -7, 3, -4, 6, 0, -2, 7, 8, 0, \
                                          -9, -1, 6, -9, 9, 7, 6, -8, -5, -6, -3, 3, 1, -5, 1, -2, -1, 7, 0, \
                                          -6, -9, 2, 4, -9, 9, -4, -9, -8, -9, 8, -3, -5, -6, -2, 6, -6, -8, \
                                          -1, 8, 0, -2, -2, 1, 7, 4, -1, -10, -7, -1, 8, 9, 3, 5, 5, -3, 1, 0, \
                                          -4, -2, 9, 6, 3, 6, -6, 4, -7, 2, 8, 6, 5, 8, 0, 8, -5, 4, -7, -1, \
                                          -1, 7, -6, 2, -2, -1, -6, 5, 0, -5, 3, -7, -4, 6, -5, -8, -5, -10, \
                                          -2, 2, -3, 5, -9, 3, 4, 4, -10, 7, -10, 3, 3, 6, 3, -5, 8, -5, 4, \
                                          -10, 2, -8, 3, -3, -1, 5, 6, -5, -7, 1, -10, -10, -9, 1, 1, 4, -6, 7, \
                                          -3, -4, -7, 2, -5, -1, -6, -2, -3, -5, -10, 3, 7, 7, 5, -7, -1, 1, \
                                          -10, -9, 6, 7, 8, 0, 4, -6, 9, 0, 4, -3, -4, 8, 8, -5, 9, 9, -2, -1, \
                                          9, -7, 8, -4, -9, 3, 9, 8, -10, 4, -5, 4, -8, 1, -1, 9, 4, 9, -8, 3, \
                                          8, -5, 7, 9, 5, 3, -9, 2, -2, -5, -2, 2, -6, 5, -7, 3, -9, 7, 7, 7, \
                                          4, -3, 6, -7, -2, -8, 7, -7, -8, -2, -3, 8, 4, 0, 0, 4, 5, 2, 6, -9, \
                                          4, 3, 3, -6, -5, 3, 5, -2, 6, 9, 5, -10, -5, -1, 6, -2, 4, 1, -7, 6, \
                                          3, -10, -7, -2, -1, -2, -5, -1, 7, 9, 5, 0, 6, -2, -8, 2, -8, 6, 2, \
                                          4, -1, 7, -4, -9, 6, -3, 5, -9, -8, -4, -9, 3, 1, -4, -5, 8, 5, -7, \
                                          9, 9, -8, 8, 6, 8, 4, -8, -7, 6, -2, -5, 2, 9, -1, 2, 6, 5, 6, -5, 6, \
                                          3, 6, -10, 6, -6, 2, 6, -9, -10, -3, 8, 3, -7, -6, -7, -4, 8, -9, 5, \
                                          -2, 5, -8, 6, -10, 1, 5, -3, 3, -5, -6, 5, 3, -8, -2, 1, -4, -10, \
                                          -10, 2, 5, 8, 0, -7, -4, -10});
    test.AddInput<float>("b_scale", {}, {1.0f});
    test.AddInput<int8_t>("b_zero_point", {}, {0});
    test.AddInput<float>("y_scale", {}, {13.2f});
    test.AddInput<int8_t>("y_zero_point", {}, {0});
    test.AddOutput<int8_t>("T3", {16, 16}, {-25, -4, 6, 10, -5, -2, -2, -6, 12, -12, 1, 2, 13, -13, -8, 18, 16, \
                                            2, -10, 7, 2, 22, 9, 11, -8, 2, -20, 8, 2, 0, -15, -2, 15, -19, 7, \
                                            -6, -8, -8, -9, 9, 12, -3, -5, 8, 11, -4, 1, 3, -8, 9, 6, 11, 11, -8, \
                                            -11, -4, 22, -1, 16, 0, -5, -3, 3, 2, -17, 4, 9, 1, -10, -23, 1, -7, \
                                            7, -14, 1, 5, 6, -22, -8, 16, 20, -20, -9, 5, 12, 8, 26, -33, 10, 10, \
                                            4, -9, -2, -3, -17, -4, -11, 9, -1, 0, 2, -7, 15, 2, 24, 2, -14, -17, \
                                            6, -10, 12, 11, 29, -14, -11, -6, -27, 30, 0, 1, 2, 3, 7, -1, 14, \
                                            -21, 9, -16, 1, 18, 3, 17, -4, 11, -16, 4, 5, -21, 0, -1, -4, -11, 0, \
                                            4, 3, -31, -5, -9, 7, -3, 26, -1, -4, -6, -15, -4, 4, -4, -12, -3, \
                                            -4, -16, 17, 8, 18, 10, -4, 1, 9, 4, 13, -21, 7, 2, -10, -20, 1, -15, \
                                            8, -17, -4, 2, 12, -16, -6, -1, -6, 11, -14, -20, -17, -1, 1, 9, -4, \
                                            12, 8, 14, 7, 10, -13, 9, -1, -3, -11, 24, 14, -11, -9, 3, -6, 6, \
                                            -21, 1, 12, -18, 7, 11, 0, 1, 9, -23, -4, -7, -1, -11, 6, -7, 4, -25, \
                                            8, -1, 19, -18, 13, 7, 5, -12, -13, 3, -13, 6, 13, 0, -20, -8, 9, 15, \
                                            14, -6, -3, 17, 19, -8, 14, 10});
    test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kCpuExecutionProvider}); // Since we round, results won't match CPU
  }
  
  }  // namespace test
  }  // namespace onnxruntime
  