onnxruntime/winml/test/api/APITest.h
Ryan Lai dcdebb409a
Refactor WinMLAPI Tests to build both google and taef test based on preprocessor definition (#2829)
* Add winml macro wrappers on top of google test macros

* change test methods to disabled

* Add custom winml macros for both taef and google tests

* PR comments

* Refactor winml api tests

* Move additional gtest specific macro definition into googleTestMacros.h
2020-01-15 12:13:56 -08:00

29 lines
1.1 KiB
C++

//-----------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
#pragma once
#include "fileHelpers.h"
namespace APITest {
static void LoadModel(const std::wstring& modelPath,
winrt::Windows::AI::MachineLearning::LearningModel& learningModel) {
std::wstring fullPath = FileHelpers::GetModulePath() + modelPath;
learningModel = winrt::Windows::AI::MachineLearning::LearningModel::LoadFromFilePath(fullPath);
};
static uint64_t GetAdapterIdQuadPart(winrt::Windows::AI::MachineLearning::LearningModelDevice& device) {
LARGE_INTEGER id;
id.LowPart = device.AdapterId().LowPart;
id.HighPart = device.AdapterId().HighPart;
return id.QuadPart;
};
static _LUID GetAdapterIdAsLUID(winrt::Windows::AI::MachineLearning::LearningModelDevice& device) {
_LUID id;
id.LowPart = device.AdapterId().LowPart;
id.HighPart = device.AdapterId().HighPart;
return id;
}
}; // namespace APITest