Move primitiveOpNames out from PrimitiveOpTypeName(), as local static variables are not thread-safe under VS2013.
This commit is contained in:
Родитель
c4c40c9bb7
Коммит
fce86cd958
|
@ -28,58 +28,60 @@ namespace std
|
|||
|
||||
namespace CNTK
|
||||
{
|
||||
// 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"},
|
||||
{PrimitiveOpType::Tanh, L"Tanh"},
|
||||
{PrimitiveOpType::ReLU, L"ReLU"},
|
||||
{PrimitiveOpType::Exp, L"Exp"},
|
||||
{PrimitiveOpType::Log, L"Log"},
|
||||
{PrimitiveOpType::Sqrt, L"Sqrt"},
|
||||
{PrimitiveOpType::Floor, L"Floor"},
|
||||
{PrimitiveOpType::Abs, L"Abs"},
|
||||
{PrimitiveOpType::Reciprocal, L"Reciprocal"},
|
||||
{PrimitiveOpType::Softmax, L"Softmax"},
|
||||
{PrimitiveOpType::Hardmax, L"Hardmax"},
|
||||
{PrimitiveOpType::TransposeAxes, L"TransposeAxes"},
|
||||
{PrimitiveOpType::Where, L"Where"},
|
||||
{PrimitiveOpType::Slice, L"Slice"},
|
||||
{PrimitiveOpType::Dropout, L"Dropout"},
|
||||
{PrimitiveOpType::Reshape, L"Reshape"},
|
||||
{PrimitiveOpType::Pooling, L"Pooling"},
|
||||
{PrimitiveOpType::SumAll, L"SumAll"},
|
||||
{PrimitiveOpType::Plus, L"Plus"},
|
||||
{PrimitiveOpType::Minus, L"Minus"},
|
||||
{PrimitiveOpType::ElementTimes, L"ElementTimes"},
|
||||
{PrimitiveOpType::Equal, L"Equal"},
|
||||
{PrimitiveOpType::NotEqual, L"NotEqual"},
|
||||
{PrimitiveOpType::Less, L"Less"},
|
||||
{PrimitiveOpType::LessEqual, L"LessEqual"},
|
||||
{PrimitiveOpType::Greater, L"Greater"},
|
||||
{PrimitiveOpType::GreaterEqual, L"GreaterEqual"},
|
||||
{PrimitiveOpType::PackedIndex, L"PackedIndex"},
|
||||
{PrimitiveOpType::GatherPacked, L"GatherPacked"},
|
||||
{PrimitiveOpType::ScatterPacked, L"ScatterPacked"},
|
||||
{PrimitiveOpType::Times, L"Times"},
|
||||
{PrimitiveOpType::TransposeTimes, L"TransposeTimes"},
|
||||
{PrimitiveOpType::Convolution, L"Convolution"},
|
||||
{PrimitiveOpType::SquaredError, L"SquaredError"},
|
||||
{PrimitiveOpType::CrossEntropyWithSoftmax, L"CrossEntropyWithSoftmax"},
|
||||
{PrimitiveOpType::ClassificationError, L"ClassificationError"},
|
||||
{PrimitiveOpType::PastValue, L"PastValue"},
|
||||
{PrimitiveOpType::FutureValue, L"FutureValue"},
|
||||
{PrimitiveOpType::ReduceElements, L"ReduceElements"},
|
||||
{PrimitiveOpType::BatchNormalization, L"BatchNormalization"},
|
||||
{PrimitiveOpType::Clip, L"Clip"},
|
||||
{PrimitiveOpType::Select, L"Select"},
|
||||
{PrimitiveOpType::Splice, L"Splice"},
|
||||
{PrimitiveOpType::Combine, L"Combine"},
|
||||
{PrimitiveOpType::RandomSample, L"RandomSample"},
|
||||
{PrimitiveOpType::RandomSampleInclusionFrequency, L"RandomSampleInclusionFrequency"},
|
||||
};
|
||||
|
||||
inline const std::wstring& PrimitiveOpTypeName(PrimitiveOpType opType)
|
||||
{
|
||||
static const std::unordered_map<PrimitiveOpType, std::wstring> primitiveOpNames = {
|
||||
{ PrimitiveOpType::Negate, L"Negate" },
|
||||
{ PrimitiveOpType::Sigmoid, L"Sigmoid" },
|
||||
{ PrimitiveOpType::Tanh, L"Tanh" },
|
||||
{ PrimitiveOpType::ReLU, L"ReLU" },
|
||||
{ PrimitiveOpType::Exp, L"Exp" },
|
||||
{ PrimitiveOpType::Log, L"Log" },
|
||||
{ PrimitiveOpType::Sqrt, L"Sqrt" },
|
||||
{ PrimitiveOpType::Floor, L"Floor" },
|
||||
{ PrimitiveOpType::Abs, L"Abs" },
|
||||
{ PrimitiveOpType::Reciprocal, L"Reciprocal" },
|
||||
{ PrimitiveOpType::Softmax, L"Softmax" },
|
||||
{ PrimitiveOpType::Hardmax, L"Hardmax" },
|
||||
{ PrimitiveOpType::TransposeAxes, L"TransposeAxes" },
|
||||
{ PrimitiveOpType::Where, L"Where" },
|
||||
{ PrimitiveOpType::Slice, L"Slice" },
|
||||
{ PrimitiveOpType::Dropout, L"Dropout" },
|
||||
{ PrimitiveOpType::Reshape, L"Reshape" },
|
||||
{ PrimitiveOpType::Pooling, L"Pooling" },
|
||||
{ PrimitiveOpType::SumAll, L"SumAll" },
|
||||
{ PrimitiveOpType::Plus, L"Plus" },
|
||||
{ PrimitiveOpType::Minus, L"Minus" },
|
||||
{ PrimitiveOpType::ElementTimes, L"ElementTimes" },
|
||||
{ PrimitiveOpType::Equal, L"Equal" },
|
||||
{ PrimitiveOpType::NotEqual, L"NotEqual" },
|
||||
{ PrimitiveOpType::Less, L"Less" },
|
||||
{ PrimitiveOpType::LessEqual, L"LessEqual" },
|
||||
{ PrimitiveOpType::Greater, L"Greater" },
|
||||
{ PrimitiveOpType::GreaterEqual, L"GreaterEqual" },
|
||||
{ PrimitiveOpType::PackedIndex, L"PackedIndex" },
|
||||
{ PrimitiveOpType::GatherPacked, L"GatherPacked" },
|
||||
{ PrimitiveOpType::ScatterPacked, L"ScatterPacked" },
|
||||
{ PrimitiveOpType::Times, L"Times" },
|
||||
{ PrimitiveOpType::TransposeTimes, L"TransposeTimes" },
|
||||
{ PrimitiveOpType::Convolution, L"Convolution" },
|
||||
{ PrimitiveOpType::SquaredError, L"SquaredError" },
|
||||
{ PrimitiveOpType::CrossEntropyWithSoftmax, L"CrossEntropyWithSoftmax" },
|
||||
{ PrimitiveOpType::ClassificationError, L"ClassificationError" },
|
||||
{ PrimitiveOpType::PastValue, L"PastValue" },
|
||||
{ PrimitiveOpType::FutureValue, L"FutureValue" },
|
||||
{ PrimitiveOpType::ReduceElements, L"ReduceElements" },
|
||||
{ PrimitiveOpType::BatchNormalization, L"BatchNormalization" },
|
||||
{ PrimitiveOpType::Clip, L"Clip" },
|
||||
{ PrimitiveOpType::Select, L"Select" },
|
||||
{ PrimitiveOpType::Splice, L"Splice" },
|
||||
{ PrimitiveOpType::Combine, L"Combine" },
|
||||
{ PrimitiveOpType::RandomSample, L"RandomSample" },
|
||||
{ PrimitiveOpType::RandomSampleInclusionFrequency, L"RandomSampleInclusionFrequency" },
|
||||
};
|
||||
|
||||
if (primitiveOpNames.find(opType) == primitiveOpNames.end())
|
||||
LogicError("Unknown PrimitiveOpType");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче