mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
[OpenVINO EP] Minor bug fixes (#1388)
* Minor bug fixes for accelerators * Added dimensionality checks for each graph input for GPU * Disabled some tests for MYRAID and GPU * This change is required for running some of the models on OpenVINO instead of falling back to default CPU EP Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * PR Feedback Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Fix missing bracket Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
This commit is contained in:
parent
8720fe62e3
commit
d2cc086bee
2 changed files with 62 additions and 16 deletions
|
|
@ -89,9 +89,9 @@ bool IsDimensionSupported(const Node* node, std::string dev_id){
|
|||
if(node->OpType().find("Pool") != std::string::npos){
|
||||
|
||||
if(dev_id == "MYRIAD" || dev_id == "HDDL"){
|
||||
if(input_dims != 3 || input_dims != 4)
|
||||
if(input_dims != 3 && input_dims != 4)
|
||||
return false;
|
||||
} else if(input_dims < 4 || input_dims > 5){
|
||||
} else if(input_dims != 4 && input_dims != 5){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -138,9 +138,9 @@ bool IsDimensionSupported(const Node* node, std::string dev_id){
|
|||
return false;
|
||||
}
|
||||
|
||||
//Only 2D input supported on MYRIAD and HDDL
|
||||
//3D input not supported on MYRIAD and HDDL
|
||||
if(dev_id == "MYRIAD" || dev_id == "HDDL"){
|
||||
if(input_dims != 2)
|
||||
if(input_dims == 3)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -216,17 +216,28 @@ bool IsGraphSupported(const onnxruntime::GraphViewer& graph_viewer, std::string
|
|||
int num_inputs = graph_viewer.GetInputs().size();
|
||||
int num_outputs = graph_viewer.GetOutputs().size();
|
||||
|
||||
if (num_inputs != 0)
|
||||
input_dims = graph_proto->input(0).type().tensor_type().shape().dim_size();
|
||||
//GPU Plugin does not support 1D and 5D input
|
||||
if(dev_id == "GPU"){
|
||||
|
||||
if (num_outputs != 0)
|
||||
output_dims = graph_proto->output(0).type().tensor_type().shape().dim_size();
|
||||
for(int i = 0; i < num_inputs; i++){
|
||||
input_dims = graph_proto->input(i).type().tensor_type().shape().dim_size();
|
||||
|
||||
if(input_dims == 1 || input_dims == 5)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//GPU Plugin does not support 5D output
|
||||
if(dev_id == "GPU"){
|
||||
|
||||
for(int i = 0; i < num_outputs; i++){
|
||||
output_dims = graph_proto->output(i).type().tensor_type().shape().dim_size();
|
||||
|
||||
if(output_dims == 5)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//GPU Plugin does not support single dimensional input and 5 dimensional input
|
||||
if (dev_id == "GPU") {
|
||||
if (input_dims == 1 || input_dims == 5 || output_dims == 5)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto index : node_indexes) {
|
||||
const auto node = graph_viewer.GetNode(index);
|
||||
|
|
@ -327,7 +338,7 @@ bool IsGraphSupported(const onnxruntime::GraphViewer& graph_viewer, std::string
|
|||
//Dropout , Identity and Concat can't have graph inputs
|
||||
if (node->OpType() == "Dropout" || node->OpType() == "Identity" || node->OpType() == "Concat") {
|
||||
auto graph_inputs = graph_viewer.GetInputs();
|
||||
for (auto input : node->InputDefs()) {
|
||||
for (const auto& input : node->InputDefs()) {
|
||||
auto it = find(graph_inputs.begin(), graph_inputs.end(), input);
|
||||
if (it != graph_inputs.end()) {
|
||||
return false;
|
||||
|
|
@ -481,7 +492,7 @@ std::vector<std::unique_ptr<ComputeCapability>> OpenVINOExecutionProvider::GetCa
|
|||
const auto node = graph_viewer.GetNode(index);
|
||||
|
||||
// Track graph inputs and initializers
|
||||
for (auto input_def : node->InputDefs()) {
|
||||
for (const auto& input_def : node->InputDefs()) {
|
||||
if (fused_outputs.find(input_def) == fused_outputs.end()) {
|
||||
fused_inputs.insert(input_def);
|
||||
} else {
|
||||
|
|
@ -490,7 +501,7 @@ std::vector<std::unique_ptr<ComputeCapability>> OpenVINOExecutionProvider::GetCa
|
|||
}
|
||||
|
||||
// Track graph outputs
|
||||
for (auto output_def : node->OutputDefs()) {
|
||||
for (const auto& output_def : node->OutputDefs()) {
|
||||
if (fused_inputs.find(output_def) == fused_inputs.end()) {
|
||||
fused_outputs.insert(output_def);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,12 @@ TEST(MathOpTest, Add) {
|
|||
{0.0f, 6.4f, 431.3f,
|
||||
0.0f, 5.0f, -36.0f,
|
||||
-10.8f, 18.6f, 0.0f});
|
||||
|
||||
#if defined(OPENVINO_CONFIG_MYRIAD) || defined(OPENVINO_CONFIG_GPU_FP16) || defined(OPENVINO_CONFIG_VAD_R)
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kOpenVINOExecutionProvider}); //OpenVINO: Disabled due to accuracy mismatch for FP16
|
||||
#else
|
||||
test.Run();
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(MathOpTest, Add_Broadcast_Axis) {
|
||||
|
|
@ -134,7 +139,14 @@ TEST(MathOpTest, Add_Broadcast_2x1x4_1x3x1) {
|
|||
211.0f, 212.0f, 213.0f, 214.0f,
|
||||
221.0f, 222.0f, 223.0f, 224.0f,
|
||||
231.0f, 232.0f, 233.0f, 234.0f});
|
||||
|
||||
#if defined(OPENVINO_CONFIG_MYRIAD) || defined(OPENVINO_CONFIG_VAD_R)
|
||||
//OpenVINO: Disabled due to software limitation for VPU Plugin.
|
||||
//This test runs fine on CPU and GPU Plugins
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider,kOpenVINOExecutionProvider});
|
||||
#else
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: Input batch size is inconsistent
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(MathOpTest, Add_Broadcast_2x1x1_3x4) {
|
||||
|
|
@ -154,7 +166,13 @@ TEST(MathOpTest, Add_Broadcast_2x1x1_3x4) {
|
|||
211.0f, 212.0f, 213.0f, 214.0f,
|
||||
221.0f, 222.0f, 223.0f, 224.0f,
|
||||
231.0f, 232.0f, 233.0f, 234.0f});
|
||||
#if defined(OPENVINO_CONFIG_MYRIAD) || defined(OPENVINO_CONFIG_VAD_R)
|
||||
//OpenVINO: Disabled due to software limitation for VPU Plugin.
|
||||
//This test runs fine on CPU and GPU Plugins
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider,kOpenVINOExecutionProvider});
|
||||
#else
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: Input batch size is inconsistent
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(MathOpTest, Sub_int32) {
|
||||
|
|
@ -457,7 +475,12 @@ TEST(MathOpTest, Sum_6) {
|
|||
{3.0f, 0.0f, 6.0f,
|
||||
-6.0f, 6.6f, 28.0f,
|
||||
-1.0f, 0.06f, 0.25f});
|
||||
|
||||
#if defined(OPENVINO_CONFIG_MYRIAD) || defined(OPENVINO_CONFIG_GPU_FP16) || defined(OPENVINO_CONFIG_VAD_R)
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kOpenVINOExecutionProvider}); //OpenVINO: Disabled due to accuracy mismatch for FP16
|
||||
#else
|
||||
test.Run();
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(MathOpTest, Sum_8_Test1) {
|
||||
|
|
@ -477,7 +500,13 @@ TEST(MathOpTest, Sum_8_Test1) {
|
|||
311.0f, 312.0f, 313.0f,
|
||||
321.0f, 322.0f, 323.0f,
|
||||
331.0f, 332.0f, 333.0f});
|
||||
#if defined(OPENVINO_CONFIG_MYRIAD) || defined(OPENVINO_CONFIG_VAD_R)
|
||||
//OpenVINO: Disabled due to software limitation for VPU Plugin.
|
||||
//This test runs fine on CPU and GPU Plugins
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider,kOpenVINOExecutionProvider});
|
||||
#else
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: Expected output shape [{3,3,3}] did not match run output shape [{3,1,1}] for sum
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(MathOpTest, Sum_8_Test2) {
|
||||
|
|
@ -506,7 +535,13 @@ TEST(MathOpTest, Sum_8_Test2) {
|
|||
3.3f, 4.4f, -94.7f,
|
||||
59.6f, 64.01f, -8.0f});
|
||||
|
||||
#if defined(OPENVINO_CONFIG_MYRIAD) || defined(OPENVINO_CONFIG_VAD_R)
|
||||
//OpenVINO: Disabled due to software limitation for VPU Plugin.
|
||||
//This test runs fine on CPU and GPU Plugins
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider,kOpenVINOExecutionProvider});
|
||||
#else
|
||||
test.Run(OpTester::ExpectResult::kExpectSuccess, "Sum is not correct", {kTensorrtExecutionProvider}); //TensorRT: result differs
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(MathOpTest, Min_6) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue