Skip to content

Commit

Permalink
[TRT] Add check to use setBindingDimensions in TRT 6.0.1+ (apache#11178)
Browse files Browse the repository at this point in the history
  • Loading branch information
apivovarov committed May 5, 2022
1 parent 21fc386 commit 795df97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/runtime/contrib/tensorrt/tensorrt_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,14 @@ class TensorRTRuntime : public JSONRuntimeBase {
const std::string name = nodes_[nid].GetOpName() + "_" + std::to_string(j);
int binding_index = engine->getBindingIndex(name.c_str());
ICHECK_NE(binding_index, -1);
#if TRT_VERSION_GE(6, 0, 1)
if (!use_implicit_batch_) {
std::vector<int64_t> shape(data_entry_[eid]->shape,
data_entry_[eid]->shape + data_entry_[eid]->ndim);
auto dims = VectorToTrtDims(shape);
ICHECK(context->setBindingDimensions(binding_index, dims));
}
#endif
if (data_entry_[eid]->device.device_type == kDLCUDA) {
bindings[binding_index] = data_entry_[eid]->data;
} else {
Expand Down

0 comments on commit 795df97

Please sign in to comment.