add 'GetOutputInfos' and 'GetInputInfos' interface (#232)

add GetOutputInfos GetInputInfos
This commit is contained in:
heliqi
2022-09-15 00:09:31 -05:00
committed by GitHub
parent 6963296a89
commit 0805ead0ed
13 changed files with 125 additions and 42 deletions

View File

@@ -247,6 +247,16 @@ TensorInfo OrtBackend::GetInputInfo(int index) {
return info;
}
std::vector<TensorInfo> OrtBackend::GetInputInfos() {
auto size = inputs_desc_.size();
std::vector<TensorInfo> infos;
infos.reserve(size);
for (auto i = 0; i < size; i++) {
infos.emplace_back(GetInputInfo(i));
}
return infos;
}
TensorInfo OrtBackend::GetOutputInfo(int index) {
FDASSERT(index < NumOutputs(),
"The index: %d should less than the number of outputs: %d.", index,
@@ -259,6 +269,14 @@ TensorInfo OrtBackend::GetOutputInfo(int index) {
return info;
}
std::vector<TensorInfo> OrtBackend::GetOutputInfos() {
std::vector<TensorInfo> infos;
for (auto i = 0; i < outputs_desc_.size(); i++) {
infos.emplace_back(GetOutputInfo(i));
}
return infos;
}
void OrtBackend::InitCustomOperators() {
#ifndef NON_64_PLATFORM
if (custom_operators_.size() == 0) {