onnxruntime/winml/lib/Api.Experimental/LearningModelJoinOptions.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

51 lines
1.3 KiB
C++

#include "lib/Api.Experimental/pch/pch.h"
#include "LearningModelJoinOptions.h"
namespace WINML_EXPERIMENTALP {
LearningModelJoinOptions::LearningModelJoinOptions()
{
GUID guid;
CoCreateGuid(&guid);
OLECHAR* guidString;
StringFromCLSID(guid, &guidString);
join_prefix_ = winrt::to_string(winrt::hstring(guidString));
// ensure memory is freed
::CoTaskMemFree(guidString);
}
bool LearningModelJoinOptions::PromoteUnlinkedOutputsToFusedOutputs()
{
return promote_unlinked_outputs_;
}
void LearningModelJoinOptions::PromoteUnlinkedOutputsToFusedOutputs(bool value)
{
promote_unlinked_outputs_ = value;
}
winrt::hstring LearningModelJoinOptions::JoinedNodePrefix()
{
return winrt::to_hstring(join_prefix_);
}
void LearningModelJoinOptions::JoinedNodePrefix(hstring const& join_prefix)
{
join_prefix_ = winrt::to_string(join_prefix);
}
bool LearningModelJoinOptions::CloseModelOnJoin()
{
return close_model_on_link_;
}
void LearningModelJoinOptions::CloseModelOnJoin(bool value)
{
close_model_on_link_ = value;
}
void LearningModelJoinOptions::Link(hstring const& firstModelOutput, hstring const& secondModelInput)
{
linkages_[winrt::to_string(firstModelOutput)] = winrt::to_string(secondModelInput);
}
const std::unordered_map<std::string, std::string>& LearningModelJoinOptions::GetLinkages() {
return linkages_;
}
}