Merge branch 'master' of https://git01.codeplex.com/cntk into amitaga/removeGPUMatrixDefaultDeviceId
This commit is contained in:
Коммит
334745b032
|
@ -128,13 +128,15 @@ void DumpNodeInfo(const ConfigParameters& config)
|
|||
{
|
||||
wstring modelPath = config("modelPath");
|
||||
wstring nodeName = config("nodeName", L"__AllNodes__");
|
||||
wstring nodeNameRegexStr = config("nodeNameRegex", L"");
|
||||
wstring defOutFilePath = modelPath + L"." + nodeName + L".txt";
|
||||
wstring outputFile = config("outputFile", WCharToString(defOutFilePath.c_str()).c_str());
|
||||
bool printValues = config("printValues", "true");
|
||||
|
||||
|
||||
ComputationNetwork net(-1); //always use CPU
|
||||
net.LoadFromFile<ElemType>(modelPath);
|
||||
net.DumpNodeInfoToFile(nodeName, printValues, outputFile);
|
||||
net.DumpNodeInfoToFile(nodeName, printValues, outputFile, nodeNameRegexStr);
|
||||
}
|
||||
|
||||
template <typename ElemType>
|
||||
|
|
|
@ -121,24 +121,48 @@ public:
|
|||
|
||||
//if node name is not found, dump all nodes
|
||||
//otherwise dump just that node
|
||||
void DumpNodeInfoToFile(const std::wstring & nodeName, const bool printValues, const std::wstring outputFile)
|
||||
void DumpNodeInfoToFile(const std::wstring & nodeName, const bool printValues, const std::wstring outputFile, const std::wstring& nodeNameInRegEx=L"")
|
||||
{
|
||||
if (NodeNameExist(nodeName))
|
||||
{
|
||||
ValidateNetwork(true); //some internal values in the nodes are computed during validation
|
||||
if (nodeNameInRegEx.empty())
|
||||
{
|
||||
if (NodeNameExist(nodeName))
|
||||
{
|
||||
ValidateNetwork(true); //some internal values in the nodes are computed during validation
|
||||
|
||||
File fstream(outputFile,
|
||||
FileOptions::fileOptionsText | FileOptions::fileOptionsWrite);
|
||||
File fstream(outputFile,
|
||||
FileOptions::fileOptionsText | FileOptions::fileOptionsWrite);
|
||||
|
||||
const ComputationNodeBasePtr nodePtr = GetNodeFromName(nodeName);
|
||||
nodePtr->DumpNodeInfo(printValues, fstream);
|
||||
}
|
||||
else //node name is not found, dump all nodes
|
||||
{
|
||||
fprintf(stderr, "Warning: node name %ls does not exist in the network. dumping all nodes.\n",
|
||||
nodeName.c_str());
|
||||
DumpAllNodesToFile(printValues, outputFile);
|
||||
}
|
||||
const ComputationNodeBasePtr nodePtr = GetNodeFromName(nodeName);
|
||||
nodePtr->DumpNodeInfo(printValues, fstream);
|
||||
}
|
||||
else //node name is not found, dump all nodes
|
||||
{
|
||||
fprintf(stderr, "Warning: node name %ls does not exist in the network. dumping all nodes.\n",
|
||||
nodeName.c_str());
|
||||
DumpAllNodesToFile(printValues, outputFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wregex NameRegEx(nodeNameInRegEx);
|
||||
std::vector<ComputationNodeBasePtr> NodeList;
|
||||
std::vector<wstring> NameList;
|
||||
for (auto m : m_nameToNodeMap)
|
||||
{
|
||||
if (regex_match(m.first, NameRegEx))
|
||||
{
|
||||
NodeList.push_back(m.second);
|
||||
NameList.push_back(m.first);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "DumpNodeInfo: %d nodes matching RegEx(%ls): \n", (int)NameList.size(), nodeNameInRegEx.c_str());
|
||||
for (auto x : NameList)
|
||||
{
|
||||
fprintf(stderr, "\t%ls\n", x.c_str());
|
||||
}
|
||||
fprintf(stderr, "DumpNodeInfo: dumping node info (%s printing values) to %ls\n", printValues ? "with" : "without", outputFile.c_str());
|
||||
DumpNodeInfoToFile(NodeList, printValues, outputFile);
|
||||
}
|
||||
}
|
||||
|
||||
//dump all nodes in the network to file
|
||||
|
|
Загрузка…
Ссылка в новой задаче