-
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.
- Loading branch information
1 parent
68262cc
commit 8ec8490
Showing
9 changed files
with
132 additions
and
33 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#include "qdq_test_utils.h" | ||
|
||
namespace onnxruntime { | ||
namespace test { | ||
|
||
GetQDQTestCaseFn BuildQDQResizeTestCase( | ||
const std::vector<int64_t>& input_shape, | ||
const std::vector<int64_t>& sizes_data) { | ||
return [input_shape, sizes_data](ModelTestBuilder& builder) { | ||
auto* input1_arg = builder.MakeInput<uint8_t>(input_shape, | ||
std::numeric_limits<uint8_t>::min(), | ||
std::numeric_limits<uint8_t>::max()); | ||
auto* roi = builder.MakeInitializer<float>({0}, {}); | ||
auto* scales = builder.MakeInitializer<float>({0}, {}); | ||
auto* sizes = builder.Make1DInitializer<int64_t>(sizes_data); | ||
auto* output_arg = builder.MakeOutput(); | ||
|
||
// add DQ | ||
auto* dq_output = builder.MakeIntermediate(); | ||
builder.AddDequantizeLinearNode<uint8_t>(input1_arg, .003f, 1, dq_output); | ||
|
||
// add Resize | ||
auto* resize_output = builder.MakeIntermediate(); | ||
Node& resize_node = builder.AddNode("Resize", {dq_output, roi, scales, sizes}, {resize_output}); | ||
|
||
// NNAPI EP does not support the default setting of Resize Op | ||
// Use bi-linear and asymmetric for NNAPI EP only | ||
#ifdef USE_NNAPI | ||
resize_node.AddAttribute("mode", "linear"); | ||
resize_node.AddAttribute("coordinate_transformation_mode", "asymmetric"); | ||
#endif | ||
// add Q | ||
builder.AddQuantizeLinearNode<uint8_t>(resize_output, .003f, 1, output_arg); | ||
}; | ||
} | ||
|
||
} // namespace test | ||
} // namespace onnxruntime |
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
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