-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sample code to separate graph C API to different files
- Loading branch information
Showing
9 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format Warning
See https://clang.llvm.org/docs/ClangFormat.html.
Run lintrunner -a to apply this patch. |
||
#include "onnxruntime_c_api.h" | ||
|
||
struct OrtGraphApi { | ||
ORT_API2_STATUS(OrtGraph_PlaceHolder, const OrtGraphViewer* graph, _Out_ int* out); | ||
}; | ||
typedef struct OrtGraphApi OrtGraphApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "core/session/onnxruntime_c_api_ep.h" | ||
#include "ort_apis_ep.h" | ||
#include "core/graph/graph_viewer.h" | ||
|
||
ORT_API_STATUS_IMPL(OrtGraphApis::OrtGraph_PlaceHolder, const OrtGraphViewer* graph, _Out_ int* out) { | ||
const ::onnxruntime::GraphViewer* graph_viewer = reinterpret_cast<const ::onnxruntime::GraphViewer*>(graph); | ||
*out = graph_viewer->NumberOfNodes(); | ||
return nullptr; | ||
} | ||
|
||
static constexpr OrtGraphApi ort_graph_api = { | ||
&OrtGraphApis::OrtGraph_PlaceHolder, | ||
}; | ||
|
||
ORT_API(const OrtGraphApi*, OrtGraphApis::GetGraphApi, uint32_t) { | ||
// No constraints on the API version yet. | ||
return &ort_graph_api; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format Warning
See https://clang.llvm.org/docs/ClangFormat.html.
Run lintrunner -a to apply this patch. |
||
|
||
namespace OrtGraphApis { | ||
ORT_API(const OrtGraphApi*, GetGraphApi, uint32_t version); | ||
ORT_API_STATUS_IMPL(OrtGraph_PlaceHolder, const OrtGraphViewer* graph, _Out_ int* out); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters