Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify transpose params check #39006

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion paddle/fluid/inference/tensorrt/op_teller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
BOOST_GET_CONST(std::vector<int>, desc.GetAttr("axis"));
if (!with_dynamic_shape && axis[0] != 0) return false;
if (axis.size() >= nvinfer1::Dims::MAX_DIMS) return false;
if (axis[0] == 0 && axis.size() == 2) return false;

auto* block = desc.Block();
if (block == nullptr) {
Expand All @@ -498,7 +497,9 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
auto x_var_name = desc.Input("X")[0];
auto* x_var_desc = block->FindVar(x_var_name);
const auto x_shape = x_var_desc->GetShape();
if (axis.size() != x_shape.size()) return false;
int dims = x_shape.size();

std::vector<int> perm(nvinfer1::Dims::MAX_DIMS);
for (int i = 0; i < dims; i++) {
perm[i] = axis[i];
Expand All @@ -517,6 +518,7 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
if (!is_valid_permutation(dims, perm)) {
VLOG(3) << "Invalid permutation dimensions for trt transpose op "
"converter: duplicate or out of bound.";
return false;
}
}
if (op_type == "flatten2" || op_type == "flatten") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
yield self.create_inference_config(), generate_trt_nodes_num(attrs,
True), 1e-5

def add_skip_trt_case(self):
def teller1(program_config, predictor_config):
if program_config.ops[0].attrs['axis'] == [0, 1]:
return True
return False

self.add_skip_case(
teller1, SkipReasons.TRT_NOT_IMPLEMENTED,
"INPUT AXIS [0, 1] NOT SUPPORT: we need to add support in the future"
)

def test(self):
self.add_skip_trt_case()
self.run_test()


Expand Down