diff --git a/MachineLearning/cn/ModelEditLanguage.cpp b/MachineLearning/cn/ModelEditLanguage.cpp index a6a50ffcf..449866968 100644 --- a/MachineLearning/cn/ModelEditLanguage.cpp +++ b/MachineLearning/cn/ModelEditLanguage.cpp @@ -93,7 +93,7 @@ void MELScript::SetProperty(ComputationNode* nodeProp, vecto // ndlPassUntil - complete processing through this pass, all passes if ndlPassAll // fullValidate - validate as a complete network? (false if this might be a snippet of a full network) template -void MELScript::ProcessNDLScript(NetNdl* netNdl, NDLPass ndlPassUntil=ndlPassAll, bool fullValidate = false) +void MELScript::ProcessNDLScript(NetNdl* netNdl, NDLPass ndlPassUntil, bool fullValidate) { NDLUtil ndlUtil(netNdl->cn); ndlUtil.ProcessNDLScript(netNdl, ndlPassUntil, fullValidate); @@ -158,7 +158,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa wstring ndlSnippetFileName = params[1]; ComputationNetwork* cn = new ComputationNetwork(CPUDEVICE); NDLScript script; - ConfigParameters ndlScript = script.ReadConfigFile(ndlSnippetFileName); + ConfigParameters ndlScript (script.ReadConfigFile(ndlSnippetFileName)); // check for a section of the snippet file we wish to read std::string section = GetOptionalSnippetSection(params, numFixedParams); @@ -241,7 +241,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa m_mapNameToNetNdl.erase(found); } else - fprintf(stderr, "WARNING: model %s does not exist.", modelName); + fprintf(stderr, "WARNING: model %s does not exist.", modelName.c_str()); } } else if (EqualInsensitive(name, "DumpModel", "Dump")) @@ -257,7 +257,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa auto found = m_mapNameToNetNdl.find(modelName); if (found == m_mapNameToNetNdl.end()) - RuntimeError("Model %s does not exist. Cannot dump non-existant model.", modelName); + RuntimeError("Model %s does not exist. Cannot dump non-existant model.", modelName.c_str()); else { NetNdl* netNdl = &found->second; @@ -317,7 +317,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa vector names = GenerateNames(params[0], params[1], netNdlFrom, netNdlTo); if (netNdlFrom != netNdlTo) - RuntimeError("CopyInputs requires two symbols from the same network, %s and %s belong to different networks", params[0], params[1]); + RuntimeError("CopyInputs requires two symbols from the same network, %s and %s belong to different networks", params[0].c_str(), params[1].c_str()); ProcessNDLScript(netNdlFrom, ndlPassAll); for (GenNameValue name : names) @@ -343,12 +343,12 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa int inputNum = params[1]; if (netNdlTo != netNdlFrom) - RuntimeError("SetNodeInput() requires two symbols from the same network, %s and %s belong to different networks", params[0], params[2]); + RuntimeError("SetNodeInput() requires two symbols from the same network, %s and %s belong to different networks", params[0].c_str(), params[2].c_str()); if (nodeFrom.size() != 1) - RuntimeError("SetNodeInput() must have a single value input, %s doesn't represent one item",params[0]); + RuntimeError("SetNodeInput() must have a single value input, %s doesn't represent one item",params[0].c_str()); if (nodeTo.size() < 1) - RuntimeError("SetNodeInput() must have at least one target, %s doesn't represent any items",params[2]); + RuntimeError("SetNodeInput() must have at least one target, %s doesn't represent any items",params[2].c_str()); // process outstanding NDL scripts ensuring that the inputs have all been resolved ProcessNDLScript(netNdlFrom, ndlPassResolve); @@ -366,7 +366,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa NetNdl* netNdlTo; vector*> nodeTo = FindSymbols(params[0], netNdlTo); if (nodeTo.size() != 1) - RuntimeError("SetNodeInputs() must have exactly one target, %s doesn't represent any node.",params[0]); + RuntimeError("SetNodeInputs() must have exactly one target, %s doesn't represent any node.",params[0].c_str()); vector*> inputNodes; inputNodes.resize(params.size()-1); @@ -380,10 +380,10 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa vector*> nodeFrom = FindSymbols(params[i], netNdlFrom); if (netNdlTo != netNdlFrom) - RuntimeError("SetNodeInputs() requires all symbols from the same network, %s and %s belong to different networks", params[0], params[i]); + RuntimeError("SetNodeInputs() requires all symbols from the same network, %s and %s belong to different networks", params[0].c_str(), params[i].c_str()); if (nodeFrom.size() != 1) - RuntimeError("SetNodeInputs() each input node should be translated to one node name. %s is translated to multiple node names.", params[i]); + RuntimeError("SetNodeInputs() each input node should be translated to one node name. %s is translated to multiple node names.", params[i].c_str()); inputNodes[i-1] = nodeFrom[0]; } @@ -434,7 +434,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa } else { - RuntimeError("Invalid property, %s, is not supported", propName); + RuntimeError("Invalid property, %s, is not supported", propName.c_str()); } // get the nodes @@ -491,7 +491,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa } default: { - RuntimeError("Invalid property, %s, is not supported", propName); + RuntimeError("Invalid property, %s, is not supported", propName.c_str()); break; } } @@ -511,7 +511,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa } else { - RuntimeError("Invalid property, %s, is not supported", propName); + RuntimeError("Invalid property, %s, is not supported", propName.c_str()); } // get the nodes @@ -533,7 +533,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa } default: { - RuntimeError("Invalid property, %s, is not supported", propName); + RuntimeError("Invalid property, %s, is not supported", propName.c_str()); break; } } @@ -558,7 +558,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa } if (nodes.size() < 1) - RuntimeError("Delete must have at least one target, %s doesn't represent any items",params[i]); + RuntimeError("Delete must have at least one target, %s doesn't represent any items", params[i].c_str()); for (ComputationNode* node : nodes) { netNdl->cn->DeleteNode(node->NodeName()); @@ -577,7 +577,7 @@ void MELScript::CallFunction(const std::string& p_name, const ConfigPa vector nodeNames = GenerateNames(params[0], params[1], netNdlFrom, netNdlTo); if (netNdlFrom != netNdlTo) - RuntimeError("CopyInputs requires two symbols from the same network, %s and %s belong to different networks", params[0], params[1]); + RuntimeError("CopyInputs requires two symbols from the same network, %s and %s belong to different networks", params[0].c_str(), params[1].c_str()); // process everything in case these nodes may have tags on them ProcessNDLScript(netNdlFrom, ndlPassAll); diff --git a/MachineLearning/cn/ModelEditLanguage.h b/MachineLearning/cn/ModelEditLanguage.h index 710cd3a60..a3f8f6d95 100644 --- a/MachineLearning/cn/ModelEditLanguage.h +++ b/MachineLearning/cn/ModelEditLanguage.h @@ -160,7 +160,7 @@ public: else { if (ndlNode->GetType() != ndlTypeConstant) - RuntimeError("Matching NDL name found for %s, but no corresponding computation node found\n", symbol); + RuntimeError("Matching NDL name found for %s, but no corresponding computation node found\n", symbol.c_str()); // probably a constant node, so make the ComputationNode that is equivalent ComputationNode* nodePtr = cn->CreateLearnableParameter(name, 1, 1); ndlNode->SetEvalValue(nodePtr); @@ -170,7 +170,7 @@ public: } } if (nodes.empty()) - RuntimeError("FindSymbols could not find a symbol for %s\n", symbol); + RuntimeError("FindSymbols could not find a symbol for %s\n", symbol.c_str()); return nodes; } @@ -396,7 +396,7 @@ public: { auto found = m_mapNameToNetNdl.find(modelName); if (found == m_mapNameToNetNdl.end()) - RuntimeError("Model %s does not exist. Cannot set it to default.", modelName); + RuntimeError("Model %s does not exist. Cannot set it to default.", modelName.c_str()); else m_netNdlDefault = &found->second; } diff --git a/MachineLearning/cn/NDLUtil.h b/MachineLearning/cn/NDLUtil.h index cced408ee..82ae2a3ec 100644 --- a/MachineLearning/cn/NDLUtil.h +++ b/MachineLearning/cn/NDLUtil.h @@ -3,11 +3,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // // + #pragma once + +#include "basetypes.h" #include "NetworkDescriptionLanguage.h" #include "ComputationNetwork.h" #include "SynchronousExecutionEngine.h" -#include "basetypes.h" #include #include "commandArgUtil.h" #include @@ -130,7 +132,7 @@ namespace Microsoft { namespace MSR { namespace CNTK { NDLNode* lastNode = script->Evaluate(ndlEvaluator, L"", ndlPass, skipThrough); if (ndlPass == ndlPassResolve) { - SetOutputNodes(script); + SetOutputNodes(script); FixupInputMinibatchSize(); } return lastNode; diff --git a/MachineLearning/cn/SynchronousExecutionEngine.h b/MachineLearning/cn/SynchronousExecutionEngine.h index e3423a12e..0c6225131 100644 --- a/MachineLearning/cn/SynchronousExecutionEngine.h +++ b/MachineLearning/cn/SynchronousExecutionEngine.h @@ -3,11 +3,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // // + #pragma once #include "IExecutionEngine.h" #include "ComputationNetwork.h" -#include "NDLUtil.h" #include "fileutil.h" // for fexists() namespace Microsoft { namespace MSR { namespace CNTK {