Skip to content

Commit

Permalink
Address PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
skottmckay committed Jan 12, 2024
1 parent 9eca662 commit f496e80
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion onnxruntime/test/framework/inference_session_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class FuseAdd : public OpKernel {
explicit FuseAdd(const OpKernelInfo& info) : OpKernel(info) {
// logic for testing that a session options config value can be read here
auto test_throw_in_ctor = info.GetConfigOptions().GetConfigEntry("ThrowInKernelCtor");
if (test_throw_in_ctor.has_value() && test_throw_in_ctor.value() == "1") {
if (test_throw_in_ctor == "1") {
ORT_THROW("Test exception in ctor");
};

Check warning on line 89 in onnxruntime/test/framework/inference_session_test.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/test/framework/inference_session_test.cc#L89

You don't need a ; after a } [readability/braces] [4]
Raw output
onnxruntime/test/framework/inference_session_test.cc:89:  You don't need a ; after a }  [readability/braces] [4]
}
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/test/optimizer/cse_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ TEST(CseTests, MergeConstants) {
std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
ASSERT_STATUS_OK(graph_transformation_mgr.Register(std::make_unique<CommonSubexpressionElimination>(),
TransformerLevel::Level1));
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
std::make_unique<ConstantFolding>(*e.get(), false /*skip_dequantize_linear*/, empty_config_options),
TransformerLevel::Level1));
Expand Down
20 changes: 10 additions & 10 deletions onnxruntime/test/optimizer/graph_transform_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ TEST_F(GraphTransformationTests, ConstantFolding) {

std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
std::make_unique<ConstantFolding>(*e.get(), false /*skip_dequantize_linear*/, empty_config_options),
TransformerLevel::Level1));
Expand All @@ -599,7 +599,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingNodesOnDifferentEP) {
ASSERT_TRUE(op_to_count["Unsqueeze"] == 2);
std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;

ASSERT_STATUS_OK(graph_transformation_mgr.Register(
std::make_unique<ConstantFolding>(*e.get(), false /*skip_dequantize_linear*/, empty_config_options),
Expand Down Expand Up @@ -630,7 +630,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingUnsupportedFloat16) {
ASSERT_TRUE(op_to_count["Mul"] == 1);
std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
std::make_unique<ConstantFolding>(*e.get(), false /*skip_dequantize_linear*/, empty_config_options),
TransformerLevel::Level1));
Expand Down Expand Up @@ -714,7 +714,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingSubgraph) {
ASSERT_TRUE(op_to_count["Add"] == 2); // one in each subgraph
std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
std::make_unique<ConstantFolding>(*e.get(), false /*skip_dequantize_linear*/, empty_config_options),
TransformerLevel::Level1));
Expand All @@ -739,7 +739,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingWithShapeToInitializer) {
InlinedHashSet<std::string_view> compatible_eps;
InlinedHashSet<std::string> excluded_initializers = {"matmul_weight"};
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;

std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
Expand Down Expand Up @@ -770,7 +770,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingWithScalarShapeToInitializer) {

InlinedHashSet<std::string_view> compatible_eps;
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;

std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
Expand Down Expand Up @@ -799,7 +799,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingForOpsWithMissingOptionalInputs)

InlinedHashSet<std::string_view> compatible_eps;
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;

std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
Expand Down Expand Up @@ -974,7 +974,7 @@ TEST_F(GraphTransformationTests, ConstantFolding_RemoveDanglingInputNodesToConst

std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());
onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
ASSERT_STATUS_OK(graph_transformation_mgr.Register(
std::make_unique<ConstantFolding>(*e.get(), false /*skip_dequantize_linear*/, empty_config_options),
TransformerLevel::Level1));
Expand All @@ -996,7 +996,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingAShapeNodeDeepInTheGraph) {
ASSERT_TRUE(op_to_count["Shape"] == 4);

onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());

ASSERT_STATUS_OK(graph_transformation_mgr.Register(
Expand Down Expand Up @@ -1025,7 +1025,7 @@ TEST_F(GraphTransformationTests, ConstantFoldingStringInitializer) {
ASSERT_EQ(op_to_count["Identity"], 1);

onnxruntime::GraphTransformerManager graph_transformation_mgr{5};
ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;
std::unique_ptr<CPUExecutionProvider> e = std::make_unique<CPUExecutionProvider>(CPUExecutionProviderInfo());

ASSERT_STATUS_OK(graph_transformation_mgr.Register(
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/test/optimizer/optimizer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ TEST(OptimizerTest, Basic) {
OptimizerExecutionFrame frame(info, fetch_mlvalue_idxs);
const logging::Logger& logger = DefaultLoggingManager().DefaultLogger();

ConfigOptions empty_config_options;
const ConfigOptions empty_config_options;

for (auto& node : graph.Nodes()) {
auto kernel = info.CreateKernel(&node, empty_config_options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ std::vector<std::unique_ptr<GraphTransformer>> GeneratePreTrainingTransformers(
transformers.emplace_back(std::make_unique<GeluApproximation>(compatible_eps));
}
InlinedHashSet<std::string> excluded_initializers(weights_to_train.begin(), weights_to_train.end());
static ConfigOptions empty_config_options;
static const ConfigOptions empty_config_options;
transformers.emplace_back(std::make_unique<ConstantFolding>(
execution_provider, false /*skip_dequantize_linear*/, empty_config_options, compatible_eps,
excluded_initializers));
Expand Down

0 comments on commit f496e80

Please sign in to comment.