onnxruntime/winml/lib/Api.Experimental/LearningModelExperimental.cpp
Sheil Kumar a17bdaf725
Enable JoinModels API in WinML+RT Experimental API (#9746)
* Dynamic onnx model fusion

* empty node names shoudl remain empty

* comments and cleanup

* logic reversed for promoting_unlined_outputs

* PR feedback

* type

* typo

* fix model outputs with promote unlinked output

* remove disembodied model

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
2021-11-12 16:56:31 -08:00

32 lines
1.2 KiB
C++

#include "lib/Api.Experimental/pch/pch.h"
#include "LearningModelExperimental.h"
#include "LearningModel.h"
#include "LearningModelJoinOptions.h"
namespace WINML_EXPERIMENTALP {
LearningModelExperimental::LearningModelExperimental(Microsoft::AI::MachineLearning::LearningModel const& model) : model_(model)
{}
winml::LearningModel LearningModelExperimental::JoinModel(winml::LearningModel const& other, winml_experimental::LearningModelJoinOptions const& options) {
telemetry_helper.LogApiUsage("LearningModelExperimental::JoinModel");
auto modelp = model_.as<winmlp::LearningModel>();
auto optionsp = options.as<winml_experimentalp::LearningModelJoinOptions>();
modelp->JoinModel(other,
optionsp->GetLinkages(),
optionsp->PromoteUnlinkedOutputsToFusedOutputs(),
optionsp->CloseModelOnJoin(),
optionsp->JoinedNodePrefix());
return model_;
}
void LearningModelExperimental::Save(hstring const& file_name) {
telemetry_helper.LogApiUsage("LearningModelExperimental::Save");
auto modelp = model_.as<winmlp::LearningModel>();
modelp->SaveToFile(file_name);
}
}