Move primitiveOpNames out from PrimitiveOpTypeName(), as local static variables are not thread-safe under VS2013.
This commit is contained in:
Родитель
c4c40c9bb7
Коммит
fce86cd958
|
@ -28,8 +28,8 @@ namespace std
|
|||
|
||||
namespace CNTK
|
||||
{
|
||||
inline const std::wstring& PrimitiveOpTypeName(PrimitiveOpType opType)
|
||||
{
|
||||
// Move primitiveOpNames out from PrimitiveOpTypeName(), as local static variables are not thread-safe under VS2013.
|
||||
// Todo: Move it into PrimitiveOpTypeName() as local static after upgraded to VS2015.
|
||||
static const std::unordered_map<PrimitiveOpType, std::wstring> primitiveOpNames = {
|
||||
{PrimitiveOpType::Negate, L"Negate"},
|
||||
{PrimitiveOpType::Sigmoid, L"Sigmoid"},
|
||||
|
@ -80,6 +80,8 @@ namespace CNTK
|
|||
{PrimitiveOpType::RandomSampleInclusionFrequency, L"RandomSampleInclusionFrequency"},
|
||||
};
|
||||
|
||||
inline const std::wstring& PrimitiveOpTypeName(PrimitiveOpType opType)
|
||||
{
|
||||
if (primitiveOpNames.find(opType) == primitiveOpNames.end())
|
||||
LogicError("Unknown PrimitiveOpType");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче