| 865 | |
| 866 | template<class precision=float> |
| 867 | void runTestWithCheck(int version, size_t M, size_t K, size_t N, |
| 868 | bool transposedInput, int kTestSize, NumType numtype) { |
| 869 | std::unique_ptr<precision[]> inputPtr = std::make_unique<precision[]>(M * K); |
| 870 | std::unique_ptr<precision[]> weightsPtr = std::make_unique<precision[]>(N * K); |
| 871 | std::unique_ptr<precision[]> outputPtr = std::make_unique<precision[]>(M * N); |
| 872 | |
| 873 | initData(M, K, N, inputPtr, weightsPtr); |
| 874 | if (transposedInput) { |
| 875 | std::unique_ptr<precision[]> transposedWeightPtr = std::make_unique<precision[]>(K * N); |
| 876 | transpose(weightsPtr.get(), transposedWeightPtr.get(), N, K); |
| 877 | runTest(version, M, K, N, inputPtr, transposedWeightPtr, outputPtr, numtype); |
| 878 | } else { |
| 879 | runTest(version, M, K, N, inputPtr, weightsPtr, outputPtr, numtype); |
| 880 | } |
| 881 | |
| 882 | if (kTestSize <= 1) { |
| 883 | // Check result with CPU reference implementation for tiny/small tests |
| 884 | checkCPU(M, K, N, inputPtr, weightsPtr, outputPtr); |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | const std::string versionToStr(int version){ |
| 889 | switch (version) { |