Skip to content

Commit 9ff71fe

Browse files
author
Ori Levari
authored
User/orilevari/outputdebugtosubdirectories (#191)
1 parent 89ce674 commit 9ff71fe

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Samples/CustomOperatorCPU/desktop/cpp/custom-operator-cpu-sample.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Global
1919
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2020
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|Any CPU.ActiveCfg = Debug|Win32
2121
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|ARM.ActiveCfg = Release|ARM
22-
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|x64.ActiveCfg = Debug|Win32
23-
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|x64.Build.0 = Debug|Win32
22+
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|x64.ActiveCfg = Debug|x64
23+
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|x64.Build.0 = Debug|x64
2424
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|x86.ActiveCfg = Debug|Win32
2525
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Debug|x86.Build.0 = Debug|Win32
2626
{2BF804D4-DAA2-42BE-9F21-0E94F021EF53}.Release|Any CPU.ActiveCfg = Release|Win32

Samples/CustomOperatorCPU/desktop/cpp/operators/debug_cpu.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ static const int CHANNELS = 1;
1717
static const int HEIGHT = 2;
1818
static const int WIDTH = 3;
1919
static const int NUM_DIMENSIONS = 4;
20+
static const int TARGET_OPSET = 7;
2021

2122
HRESULT DebugShapeInferrer::InferOutputShapes (IMLOperatorShapeInferenceContext* context) noexcept
2223
{
@@ -95,6 +96,12 @@ void WriteToPng(vector<uint32_t> inputDims, T* inputData, uint32_t size, hstring
9596

9697
template <typename T>
9798
void WriteToText(vector<uint32_t> inputDims, T* inputData, uint32_t size, hstring m_filePath, MLOperatorTensorDataType dataType) {
99+
// Get current directory
100+
wchar_t buf[MAX_PATH];
101+
_wgetcwd(buf, 256);
102+
StorageFolder parentFolder = StorageFolder::GetFolderFromPathAsync(buf).get();
103+
parentFolder.CreateFileAsync(m_filePath, CreationCollisionOption::ReplaceExisting).get();
104+
98105
ofstream outputFile;
99106
outputFile.open(winrt::to_string(m_filePath));
100107
outputFile << "dimensions: ";
@@ -270,7 +277,7 @@ void DebugOperatorFactory::RegisterDebugSchema(winrt::com_ptr<IMLOperatorRegistr
270277
{
271278
MLOperatorSetId operatorSetId;
272279
operatorSetId.domain = "";
273-
operatorSetId.version = 7;
280+
operatorSetId.version = TARGET_OPSET;
274281

275282
MLOperatorSchemaDescription debugSchema;
276283
debugSchema.name = "Debug";
@@ -356,7 +363,7 @@ void DebugOperatorFactory::RegisterDebugSchema(winrt::com_ptr<IMLOperatorRegistr
356363
std::vector<const MLOperatorSchemaDescription*> schemas{ &debugSchema };
357364
registry->RegisterOperatorSetSchema(
358365
&operatorSetId,
359-
7 /* baseline version */,
366+
TARGET_OPSET /* baseline version */,
360367
schemas.data(),
361368
static_cast<uint32_t>(schemas.size()),
362369
nullptr,

0 commit comments

Comments
 (0)