onnxruntime/winml/lib/Api/LearningModelSessionOptions.cpp
Tiago Koji Castro Shibata 62c0d24340
Fix Windows Store build (#8753)
* Remove APIs unavailable in Store in #8349, #8178, #8065

* Add UWP stubs of C runtime functions

* Remove UWP incompatible tests from UWP build

* Remove incompatible tests from Store

* Use UWP stubs in store only

* Skip partition check outside of Windows

* Remove unused WRL include

* Workaround Windows header not including what it uses

* Fix precompiled header name clash

* Workaround SDK bugs

* DXCore workaround in Win7

* Fix warning

* Fix more warnings

* Bump WinML to target Windows 8

* Fix more warnings

* Remove unnecessary workarounds

* Remove Desktop only APIs from DML adapter
2021-08-23 11:19:03 -07:00

55 lines
2 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "lib/Api/pch/pch.h"
#include "LearningModelSessionOptions.h"
namespace WINMLP {
LearningModelSessionOptions::LearningModelSessionOptions(const LearningModelSessionOptions& options) : batch_size_override_(options.batch_size_override_),
close_model_on_session_creation_(options.close_model_on_session_creation_) {}
uint32_t LearningModelSessionOptions::BatchSizeOverride() {
return batch_size_override_;
}
void LearningModelSessionOptions::BatchSizeOverride(uint32_t value) {
batch_size_override_ = value;
}
bool LearningModelSessionOptions::CloseModelOnSessionCreation() {
return close_model_on_session_creation_;
}
void LearningModelSessionOptions::CloseModelOnSessionCreation(bool value) {
close_model_on_session_creation_ = value;
}
wfc::IMapView<winrt::hstring, uint32_t> LearningModelSessionOptions::NamedDimensionOverrides() {
return named_dim_overrides_.GetView();
}
void LearningModelSessionOptions::OverrideNamedDimension(winrt::hstring name, uint32_t value) {
named_dim_overrides_.Insert(name, value);
telemetry_helper.SetNamedDimensionOverride(name, value);
}
uint32_t LearningModelSessionOptions::GetIntraOpNumThreads() {
return intra_op_num_threads_override_;
}
STDMETHODIMP LearningModelSessionOptions::SetIntraOpNumThreadsOverride(uint32_t intraOpNumThreads) noexcept {
intra_op_num_threads_override_ = intraOpNumThreads;
telemetry_helper.SetIntraOpNumThreadsOverride(intraOpNumThreads);
return S_OK;
}
bool LearningModelSessionOptions::GetIntraOpThreadSpinning() {
return allow_thread_spinning_;
}
STDMETHODIMP LearningModelSessionOptions::SetIntraOpThreadSpinning(boolean allowSpinning) noexcept {
allow_thread_spinning_ = allowSpinning;
telemetry_helper.SetIntraOpThreadSpinning(allowSpinning);
return S_OK;
}
} // namespace WINMLP