diff --git a/Math/CNTKMathTest/CNTKMathTest.vcxproj b/Math/CNTKMathTest/CNTKMathTest.vcxproj deleted file mode 100644 index 748d162c1d0d..000000000000 --- a/Math/CNTKMathTest/CNTKMathTest.vcxproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {6CEE834A-8104-46A8-8902-64C81BD7928F} - - - - - - - - - Win32Proj - CNTKMathTest - - - - DynamicLibrary - true - v120 - Unicode - false - - - DynamicLibrary - false - v120 - true - Unicode - false - - - - - - - - - - - - - - true - ..\..\common\include\;$(IncludePath) - $(Platform)\$(Configuration)\$(ProjectName)\ - - - true - ..\..\common\include\;$(IncludePath);$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - NotUsing - Level4 - Disabled - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - true - true - - - Windows - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - 64 - compute_20,sm_20;compute_30,sm_30;%(CodeGeneration) - - - - - Level4 - Use - MaxSpeed - true - true - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;%(PreprocessorDefinitions) - true - true - true - false - /d2Zi+ %(AdditionalOptions) - - - Windows - true - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - - - - - - - Create - Create - - - NotUsing - NotUsing - - - - - {60bdb847-d0c4-4fd3-a947-0c15c08bcdb5} - true - true - false - true - false - - - - - - - \ No newline at end of file diff --git a/Math/CNTKMathTest/GPUWatcherTests.cpp b/Math/CNTKMathTest/GPUWatcherTests.cpp deleted file mode 100644 index 223b3e7abbdf..000000000000 --- a/Math/CNTKMathTest/GPUWatcherTests.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -#include "stdafx.h" -#include "CppUnitTest.h" -#include "..\Math\GPUWatcher.h" - -#define epsilon 0.000001 -#define IDX2C(i,j,ld) (((j)*(ld))+(i)) // 0 based indexing - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -#if 0 // BUGBUG: This somehow does not link, GetFreeMemoryOnCUDADevice is missing from CNTKMath.dll. Commening out so that we can at least get all other tests to run. -namespace CNTKMathTest -{ - TEST_CLASS(GPUWatcherTests) - { - - public: - - //This test should fail if you don't have CUDA GPU (or working under remote desktop) - TEST_METHOD(GetFreeMemoryOnCUDADeviceTest) - { - size_t x = GPUWatcher::GetFreeMemoryOnCUDADevice(0); - Assert::IsTrue(x>0); - } - }; -} -#endif diff --git a/Math/CNTKMathTest/MatrixQuantizerTests.cpp b/Math/CNTKMathTest/MatrixQuantizerTests.cpp deleted file mode 100644 index e3a812e6a2f1..000000000000 --- a/Math/CNTKMathTest/MatrixQuantizerTests.cpp +++ /dev/null @@ -1,505 +0,0 @@ -// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -#include "stdafx.h" -#include "CppUnitTest.h" -#include "File.h" -#include -#include -#include - -#include "..\..\common\include\fileutil.h" -#include "..\..\common\include\File.h" -#include "..\..\common\File.cpp" -#include "..\..\common\fileutil.cpp" -#include - -#include "..\Math\MatrixQuantizer.h" -#include "..\Math\CUDAPageLockedMemAllocator.h" -#include "..\Math\ValueQuantizer.h" - -#define DEBUG_FLAG 1 -using namespace Microsoft::MSR::CNTK; - -#pragma warning (disable: 4305) - -using namespace Microsoft::MSR::CNTK; -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -//#define DEBUG_OUTPUT_PATH L"E:/temp/MatrixQuantizerTest.out.txt" - -#pragma warning (disable: 4996) - -void RedirectStdErrAndStdOut(wstring logpath) -{ - fprintf(stderr, "Redirecting stderr to file %S\n", logpath.c_str()); - auto f = make_shared(logpath.c_str(), fileOptionsWrite | fileOptionsText); - if (dup2(fileno(*f), 1) == -1) - RuntimeError("unexpected failure to redirect stdout to log file"); - if (dup2(fileno(*f), 2) == -1) - RuntimeError("unexpected failure to redirect stderr to log file"); - setvbuf(stderr, NULL, _IONBF, 16384); // unbuffer it - static auto fKept = f; // keep it around (until it gets changed) -} - -namespace CNTKMathTest -{ - TEST_CLASS(MatrixQuantizerTests) - { - private: - - static const float SINGLE_PRECISION_TOLERANCE; - static const double DOUBLE_PRECISION_TOLERANCE; - static const float SINGLE_PRECISION_GPU_QUANTIZATION_TOLERANCE; - - template - static void ReferenceCPUQuantizer( - size_t numBits, - size_t numRows, - size_t numCols, - const ElemType* inMatrix, - const ElemType* prevResidualMatrix, - const ElemType* prevOutMatrix, - ElemType* outMatrix, - ElemType* outResidualMatrix, - bool zeroThresholdFor1Bit) - { - typedef typename QuantizedWordHelper::ValueType QWordVal; - typedef typename QuantizedWordHelper::ValueTypeSigned QWordValSigned; - - // Just pass through the values if numBits is of the full size of the ElemType - if (numBits == (8 * sizeof(ElemType))) - { - for (size_t j = 0; j < numCols; j++) - { - for (int i = 0; i < numRows; i++) - { - size_t flatIdx = (j * numRows) + i; - ElemType val = inMatrix[flatIdx] + prevResidualMatrix[flatIdx]; - outMatrix[flatIdx] = prevOutMatrix[flatIdx] + val; - outResidualMatrix[flatIdx] = 0; - } - } - - return; - } - - for (size_t j = 0; j < numCols; j++) - { - ElemType mean = 0.0f; - if (!zeroThresholdFor1Bit || (numBits != 1)) - { - ElemType sum = (ElemType)0.0; - for (int i = 0; i < numRows; i++) - { - size_t flatIdx = (j * numRows) + i; - sum += inMatrix[flatIdx] + prevResidualMatrix[flatIdx]; - } - mean = sum / numRows; - } - - ElemType radius = 0.0f; - ElemType newMean = 0.0f; - ElemType quantiMin; - ElemType quantiMax; - if (numBits == 1) - { - // Calculate the mean0 and mean1 for each column - ElemType mean0Sum = 0.0f; - ElemType mean1Sum = 0.0f; - int num0 = 0; - int num1 = 0; - for (int i = 0; i < numRows; i++) - { - size_t flatIdx = (j * numRows) + i; - ElemType val = inMatrix[flatIdx] + prevResidualMatrix[flatIdx]; - if (val < mean) - { - mean0Sum += val; - num0++; - } - else - { - mean1Sum += val; - num1++; - } - } - - if (!zeroThresholdFor1Bit) - { - // we minimize the error jointly across positive and negative numbers to make things - // symmetrical around the mean (which may be non-zero) tying the two sides - ElemType devacc0 = (num0 * mean) - mean0Sum; - ElemType devacc1 = mean1Sum - (num1 * mean); - - // both deviations tied, to ensure consistent mean - ElemType dev = (devacc0 + devacc1) / numRows; - radius = (ElemType)2.0 * dev; - newMean = mean; - } - else - { - // happens for all-zero columns which do exist (mean0 is 0 in that case) - if (num0 == 0) num0 = 1; - if (num1 == 0) num1 = 1; - - const ElemType mean0 = mean0Sum / num0; - const ElemType mean1 = mean1Sum / num1; - - newMean = (ElemType)0.5 * (mean0 + mean1); - radius = (ElemType)2.0 * (mean1 - newMean); - } - - quantiMin = newMean - radius; - quantiMax = newMean + radius; - } - else - { - // >1 bit: - // We linearly quantize between 'stddevs' standard deviations. - ElemType stddevs = 5.0f; - ElemType varacc = 0.0f; - for (int i = 0; i < numRows; i++) - { - size_t flatIdx = (j * numRows) + i; - ElemType val = inMatrix[flatIdx] + prevResidualMatrix[flatIdx]; - varacc += (val - mean) * (val - mean); - } - - ElemType stddev = sqrt(varacc / numRows); - quantiMin = mean - (stddevs * stddev); - quantiMax = mean + (stddevs * stddev); - } - - ElemType qFactor; - ElemType uFactor; - QWordVal rangeSize = ((QWordVal)1) << numBits; - - // must protect against NaN: interval is 0 -> quantization is futile, just emit 0 - if (((quantiMax - quantiMin) < 1e-36f) || (rangeSize == 0)) - { - qFactor = uFactor = (ElemType)0.0; - } - else - { - qFactor = rangeSize / (quantiMax - quantiMin); - uFactor = (quantiMax - quantiMin) / rangeSize; - } - - for (int i = 0; i < numRows; i++) - { - size_t flatIdx = (j * numRows) + i; - ElemType val = inMatrix[flatIdx] + prevResidualMatrix[flatIdx]; - ElemType qVal; - - if (numBits == 1) - { - if (val < mean) - { - qVal = newMean - ((ElemType)0.5 * radius); - } - else - { - qVal = newMean + ((ElemType)0.5 * radius); - } - } - else - { - QWordValSigned result; - if (val <= quantiMin) - { - result = 0; - } - else if (val >= quantiMax) - { - result = (QWordValSigned)(rangeSize - 1); - } - else - { - result = (QWordValSigned)((val - quantiMin) * qFactor); - } - - qVal = (((QWordVal)result + (ElemType)0.5) * uFactor) + quantiMin; - } - - outMatrix[flatIdx] = prevOutMatrix[flatIdx] + qVal; - outResidualMatrix[flatIdx] = val - qVal; - } - } - } - - template - static void TestQuantization( - size_t numBits, - size_t numRows, - size_t numCols, - ElemType rangeLow, - ElemType rangeHigh, - int seed, - int numIterations, - short deviceId, - bool zeroThresholdFor1Bit) - { - auto verifyAllZerosFunc = [](const Matrix& matrix) { - ElemType* cpuMatrix = matrix.CopyToArray(); - size_t numMatrixElems = matrix.GetNumElements(); - for (size_t i = 0; i < numMatrixElems; ++i) - { - Assert::IsTrue(cpuMatrix[i] == ((ElemType)0)); - } - - delete[] cpuMatrix; - }; - - MemAllocator* allocator = nullptr; - if (deviceId != CPUDEVICE) - { - allocator = new CUDAPageLockedMemAllocator(deviceId); - } - - Matrix inMatrix(numRows, numCols, deviceId); - auto quantizer = MatrixQuantizer::CreateMatrixQuantizer(numRows, numCols, deviceId); - - // Verify that the initial residue is comprised of all zeros - verifyAllZerosFunc(quantizer->GetResidualMatrix()); - - Matrix outMatrix(numRows, numCols, deviceId); - // Verify that the outMatrix is initialized with all zeros - verifyAllZerosFunc(outMatrix); - - for (int iterNum = 0; iterNum < numIterations; ++iterNum) - { - inMatrix = Matrix::RandomUniform(numRows, numCols, rangeLow, rangeHigh, seed + iterNum, deviceId); - - ElemType* gpuInMatrix = inMatrix.CopyToArray(); - ElemType* gpuPrevResidualMatrix = quantizer->GetResidualMatrix().CopyToArray(); - ElemType *gpuPrevOutMatrix = outMatrix.CopyToArray(); - -#ifdef DEBUG_OUTPUT_PATH - bool peekOnly = true; - const size_t numRowsToPeek = 3; - const size_t numColsToPeek = 3; - size_t numRowsToPrint; - size_t numColsToPrint; - if (peekOnly) - { - numRowsToPrint = (std::min)(numRowsToPeek, numRows); - numColsToPrint = (std::min)(numColsToPeek, numCols); - } - else - { - numRowsToPrint = numRows; - numColsToPrint = numCols; - } - - inMatrix.Print("Input Matrix", 0, numRowsToPrint - 1, 0, numColsToPrint - 1); - quantizer->GetResidualMatrix().Print("Old Residual Matrix", 0, numRowsToPrint - 1, 0, numColsToPrint - 1); - outMatrix.Print("Old Output Matrix", 0, numRowsToPrint - 1, 0, numColsToPrint - 1); -#endif - - QuantizedMatrix tempCPUQuantizationBuffer(numRows, numCols, numBits, CPUDEVICE, allocator); - quantizer->QuantizeAsync(inMatrix, tempCPUQuantizationBuffer, zeroThresholdFor1Bit); - quantizer->WaitQuantizeAsyncDone(); - -#ifdef DEBUG_OUTPUT_PATH - tempCPUQuantizationBuffer.Print("Quantized Matrix", 0, numRowsToPrint - 1, 0, numColsToPrint - 1); - quantizer->GetResidualMatrix().Print("New residual Matrix", 0, numRowsToPrint - 1, 0, numColsToPrint - 1); -#endif - - quantizer->UnquantizeAsync(tempCPUQuantizationBuffer, outMatrix, (iterNum > 0)); - quantizer->WaitUnquantizeAsyncDone(); - -#ifdef DEBUG_OUTPUT_PATH - outMatrix.Print("Unquantized Output Matrix", 0, numRowsToPrint - 1, 0, numColsToPrint - 1); -#endif - - // Now verify the quantization results - ElemType* gpuNewResidualMatrix = quantizer->GetResidualMatrix().CopyToArray(); - ElemType* gpuNewOutMatrix = outMatrix.CopyToArray(); - - ElemType PRECISION_TOLERANCE = (std::is_same::value) ? ((ElemType)DOUBLE_PRECISION_TOLERANCE) : SINGLE_PRECISION_TOLERANCE; - ElemType tolerance = 0.0f; - if (numBits != (8 * sizeof(ElemType))) - { - tolerance = (rangeHigh - rangeLow) * PRECISION_TOLERANCE; - } - // First verify that (cpuInMatrix + cpuPrevResidualMatrix + cpuPrevOutMatrix == gpuNewResidualMatrix + gpuNewOutMatrix) - size_t numMatrixElems = inMatrix.GetNumElements(); - for (size_t i = 0; i < numMatrixElems; ++i) - { - Assert::IsTrue(fabs((gpuInMatrix[i] + gpuPrevResidualMatrix[i] + gpuPrevOutMatrix[i]) - (gpuNewResidualMatrix[i] + gpuNewOutMatrix[i])) <= tolerance); - } - - size_t numIncorrectAllowed = 0; - if (std::is_same::value && (deviceId >= 0)) - { - // We allow a small number of incorrect results when computing on the GPU - // for single precision since, in rare cases, the value of the CPU and GPU - // may quantize to different integers resulting in difference larger than - // what is allowed by tolerance - numIncorrectAllowed = (std::max)((size_t)1, (size_t)(numMatrixElems * SINGLE_PRECISION_GPU_QUANTIZATION_TOLERANCE)); - } - - // Now verify against the reference CPU quantizer - size_t numIncorrectOutValue = 0; - size_t numIncorrectResidualValue = 0; - ElemType* refNewOutMatrix = new ElemType[numMatrixElems]; - ElemType* refNewResidualMatrix = new ElemType[numMatrixElems]; - ReferenceCPUQuantizer(numBits, numRows, numCols, gpuInMatrix, gpuPrevResidualMatrix, gpuPrevOutMatrix, refNewOutMatrix, refNewResidualMatrix, zeroThresholdFor1Bit); - for (size_t i = 0; i < numMatrixElems; ++i) - { - if (fabs(gpuNewOutMatrix[i] - refNewOutMatrix[i]) > tolerance) - { - numIncorrectOutValue++; - if (numIncorrectOutValue > numIncorrectAllowed) - { - Assert::IsTrue(fabs(gpuNewOutMatrix[i] - refNewOutMatrix[i]) <= tolerance); - } - } - - if (fabs(gpuNewResidualMatrix[i] - refNewResidualMatrix[i]) > tolerance) - { - numIncorrectResidualValue++; - if (numIncorrectResidualValue > numIncorrectAllowed) - { - Assert::IsTrue(fabs(gpuNewResidualMatrix[i] - refNewResidualMatrix[i]) <= tolerance); - } - } - } - - delete[] gpuInMatrix; - delete[] gpuPrevResidualMatrix; - delete[] gpuPrevOutMatrix; - delete[] gpuNewResidualMatrix; - delete[] gpuNewOutMatrix; - delete[] refNewOutMatrix; - delete[] refNewResidualMatrix; - } - - delete quantizer; - delete allocator; - } - - template - static void TestQuantization(short deviceId) - { - // Test quantization for all power of 2 bit sizes - const size_t maxNumBits = 8 * sizeof(ElemType); - for (size_t numBits = 1; numBits <= maxNumBits; numBits = numBits * 2) - { - // Test 1 bit quantization both with and without zeroThresholdFor1Bit setting - for (int i = 0; i < 2; ++i) - { - bool zeroThresholdFor1Bit = (i == 1); - - // zeroThresholdFor1Bit test applicable only for 1 bit - if ((numBits != 1) && zeroThresholdFor1Bit) - { - continue; - } - - // Test quantization on a matrix initialized with floating point numbers between -1 and + 1 - size_t numRows = 256; - size_t numCols = 135; - float rangeLow = -1.0f; - float rangeHigh = 1.0f; - int seed = 2015; - int numIterations = 5; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with smaller range of values - seed += 100; - rangeLow = -0.005f; - rangeHigh = 0.005f; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with a very small range of values - seed += 100; - rangeLow = -0.00001f; - rangeHigh = 0.00001f; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with larger range of values - seed += 100; - rangeLow = -10.0f; - rangeHigh = 10.0f; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with assymmetric range of values - seed += 100; - rangeLow = -1.0f; - rangeHigh = 2.05f; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with a single column - seed += 100; - rangeLow = -0.5f; - rangeHigh = 0.5f; - numRows = 489; - numCols = 1; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with a single row - seed += 100; - rangeLow = -0.5f; - rangeHigh = 0.5f; - numRows = 1; - numCols = 135; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with a number of rows that is not a multiple of the number of bits in a quantized word - seed += 100; - rangeLow = -0.5f; - rangeHigh = 0.5f; - numRows = 89; - numCols = 23; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test a matrix with a number of rows less than number of bits in a quantized word - seed += 100; - rangeLow = -0.5f; - rangeHigh = 0.5f; - numRows = 15; - numCols = 135; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - - // Test with a large matrix - seed += 100; - rangeLow = -0.5f; - rangeHigh = 0.5f; - numRows = 737; - numCols = 373; - TestQuantization(numBits, numRows, numCols, rangeLow, rangeHigh, seed, numIterations, deviceId, zeroThresholdFor1Bit); - } - } - } - - public: - //This test will fail without GPU - TEST_METHOD(Matrix1BitQuantize) - { -#ifdef DEBUG_OUTPUT_PATH - RedirectStdErrAndStdOut(DEBUG_OUTPUT_PATH); -#endif - const int GPUDEVICE = 0; - - // Test single precision 1bit quantization on GPU - TestQuantization(GPUDEVICE); - - // Test double precision 1bit quantization on GPU - TestQuantization(GPUDEVICE); - - // Test single precision 1bit quantization on CPU - TestQuantization(CPUDEVICE); - - // Test double precision 1bit quantization on CPU - TestQuantization(CPUDEVICE); - } - }; - - /*static*/ const float MatrixQuantizerTests::SINGLE_PRECISION_TOLERANCE = 0.00005f; - /*static*/ const double MatrixQuantizerTests::DOUBLE_PRECISION_TOLERANCE = 0.000000001; - /*static*/ const float MatrixQuantizerTests::SINGLE_PRECISION_GPU_QUANTIZATION_TOLERANCE = 0.0001f; -} diff --git a/Math/CNTKMathTest/stdafx.cpp b/Math/CNTKMathTest/stdafx.cpp deleted file mode 100644 index c33c3d11bc0c..000000000000 --- a/Math/CNTKMathTest/stdafx.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// stdafx.cpp : source file that includes just the standard includes -// CNTKMathTest.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/Math/CNTKMathTest/stdafx.h b/Math/CNTKMathTest/stdafx.h deleted file mode 100644 index bc30f65ba20c..000000000000 --- a/Math/CNTKMathTest/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#define _CRT_SECURE_NO_WARNINGS // "secure" CRT not available on all platforms -#include "targetver.h" - -// Headers for CppUnitTest -#pragma warning (disable: 4505) // 'Microsoft::VisualStudio::CppUnitTestFramework::ToString' : unreferenced local function has been removed -#include "CppUnitTest.h" - -// TODO: reference additional headers your program requires here diff --git a/Math/CNTKMathTest/targetver.h b/Math/CNTKMathTest/targetver.h deleted file mode 100644 index e0f1e69ca9f1..000000000000 --- a/Math/CNTKMathTest/targetver.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/Tests/UnitTests/MathTests/MathTests.vcxproj b/Tests/UnitTests/MathTests/MathTests.vcxproj index f80fadeb9623..7040ed6cc54c 100644 --- a/Tests/UnitTests/MathTests/MathTests.vcxproj +++ b/Tests/UnitTests/MathTests/MathTests.vcxproj @@ -127,6 +127,7 @@ + Create diff --git a/Tests/UnitTests/MathTests/MatrixQuantizerTests.cpp b/Tests/UnitTests/MathTests/MatrixQuantizerTests.cpp index e51767379b85..0b7e5b5e0644 100644 --- a/Tests/UnitTests/MathTests/MatrixQuantizerTests.cpp +++ b/Tests/UnitTests/MathTests/MatrixQuantizerTests.cpp @@ -45,9 +45,12 @@ namespace Microsoft { namespace MSR { namespace CNTK { namespace Test { #else static bool createDebugOut = false; #endif - static const float c_SinglePrecisionTolerance = 0.00005f; - static const double c_DoublePrecisionTolerance = 0.000000001; - static const float c_SinglePrecisionGpuQuantizationTolerance = 0.0001f; + //static const float c_SinglePrecisionTolerance = 0.00005f; + //static const double c_DoublePrecisionTolerance = 0.000000001; + //static const float c_SinglePrecisionGpuQuantizationTolerance = 0.0001f; + static const float c_SinglePrecisionTolerance = 0.0001f; + static const double c_DoublePrecisionTolerance = 0.00000001; + static const float c_SinglePrecisionGpuQuantizationTolerance = 0.001f; template static void ReferenceCPUQuantizer(