Skip to content

Commit 5c7c6b1

Browse files
authored
revert ProgOptimUnsupported check, test=release/1.6 (#21475)
1 parent badaaee commit 5c7c6b1

File tree

3 files changed

+0
-58
lines changed

3 files changed

+0
-58
lines changed

paddle/fluid/framework/op_compatible_info.cc

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -215,50 +215,5 @@ bool OpCompatibleMap::ReadFromProto(const proto::OpCompatibleMap& desc) {
215215
return true;
216216
}
217217

218-
bool ProgOptimUnsupported(std::shared_ptr<framework::ProgramDesc> program) {
219-
auto op_type_checker = [](const std::string& name) {
220-
const std::vector<std::string> op_types({
221-
"conv2d", "conv3d", "conv2d_transpose", "conv3d_transpose",
222-
"depthwise_conv2d", "depthwise_conv2d_transpose", "pool2d", "pool3d",
223-
});
224-
return std::find(op_types.begin(), op_types.end(), name) != op_types.end();
225-
};
226-
auto checker = [](const framework::OpDesc& op) {
227-
if (op.HasAttr("paddings") && op.HasAttr("strides")) {
228-
auto paddings = boost::get<std::vector<int>>(op.GetAttr("paddings"));
229-
auto strides = boost::get<std::vector<int>>(op.GetAttr("strides"));
230-
if (paddings.size() != strides.size()) {
231-
VLOG(3) << "== paddings size is not equal to strides size.";
232-
return true;
233-
}
234-
}
235-
if (op.HasAttr("data_format")) {
236-
auto data_format = boost::get<std::string>(op.GetAttr("data_format"));
237-
if (data_format == "NHWC" || data_format == "NDHWC") {
238-
VLOG(3) << "== data_format is NHWC or NDHWC.";
239-
return true;
240-
}
241-
}
242-
if (op.HasAttr("padding_algorithm")) {
243-
auto padding_algorithm =
244-
boost::get<std::string>(op.GetAttr("padding_algorithm"));
245-
if (padding_algorithm != "EXPLICIT") {
246-
VLOG(3) << "== padding_algorithm is not EXPLICIT.";
247-
return true;
248-
}
249-
}
250-
return false;
251-
};
252-
for (size_t i = 0; i < program->Size(); i++) {
253-
const auto& block = program->Block(i);
254-
for (auto* op : block.AllOps()) {
255-
if ((op_type_checker(op->Type())) && checker(*op)) {
256-
return true;
257-
}
258-
}
259-
}
260-
return false;
261-
}
262-
263218
} // namespace framework
264219
} // namespace paddle

paddle/fluid/framework/op_compatible_info.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
#include <map>
16-
#include <memory>
1716
#include <string>
1817
#include "paddle/fluid/framework/program_desc.h"
1918

@@ -71,9 +70,5 @@ class OpCompatibleMap {
7170
std::string default_required_version_;
7271
};
7372

74-
// Determine if the model contains operators that the optimization cannot
75-
// support.
76-
bool ProgOptimUnsupported(std::shared_ptr<framework::ProgramDesc> program);
77-
7873
} // namespace framework
7974
} // namespace paddle

paddle/fluid/inference/api/analysis_predictor.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,6 @@ void AnalysisPredictor::PrepareArgument() {
458458

459459
// NOTE All the members in AnalysisConfig should be copied to Argument.
460460
void AnalysisPredictor::OptimizeInferenceProgram() {
461-
if (ProgOptimUnsupported(inference_program_)) {
462-
LOG(INFO) << "NOTICE: Your inference model contains parameters such "
463-
"as asymmetric padding, and ir optimization is temporarily "
464-
"not supported, "
465-
"so it is turned off.";
466-
config_.SwitchIrOptim(false);
467-
argument_.SetEnableAnalysisOptim(false);
468-
}
469461
PrepareArgument();
470462
Analyzer().Run(&argument_);
471463

0 commit comments

Comments
 (0)