// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.md file in the project root for full license information. // // EsotericActions.cpp -- CNTK actions that are deprecated // #define _CRT_NONSTDC_NO_DEPRECATE // make VS accept POSIX functions without _ #include "stdafx.h" #include "Basics.h" #include "Actions.h" #include "ComputationNetwork.h" #include "ComputationNode.h" #include "DataReader.h" #include "DataWriter.h" #include "SimpleNetworkBuilder.h" #include "Config.h" #include "ScriptableObjects.h" #include #include #include #include #include #include #include #include #ifndef let #define let const auto #endif using namespace std; using namespace Microsoft::MSR; using namespace Microsoft::MSR::CNTK; // =========================================================================== // DoConvertFromDbn() - implements CNTK "convertdbn" command // =========================================================================== template void DoConvertFromDbn(const ConfigParameters& config) { wstring modelPath = config(L"modelPath"); wstring dbnModelPath = config(L"dbnModelPath"); auto netBuilder = make_shared>(config); ComputationNetworkPtr net = netBuilder->BuildNetworkFromDbnFile(dbnModelPath); net->Save(modelPath); } // =========================================================================== // DoExportToDbn() - implements CNTK "exportdbn" command // =========================================================================== template void DoExportToDbn(const ConfigParameters& config) { DEVICEID_TYPE deviceID = DeviceFromConfig(config); const wstring modelPath = config("modelPath"); wstring dbnModelPath = config("dbnModelPath"); ComputationNetworkPtr net = make_shared(deviceID); net->Load(modelPath); // write dbn file net->SaveToDbnFile(net, dbnModelPath); } template void DoConvertFromDbn(const ConfigParameters& config); template void DoConvertFromDbn(const ConfigParameters& config); template void DoExportToDbn(const ConfigParameters& config); template void DoExportToDbn(const ConfigParameters& config);