|
|
@ -57,6 +57,7 @@ contrib::AnalysisConfig::AnalysisConfig(const contrib::AnalysisConfig &other) {
|
|
|
|
use_tensorrt_ = other.use_tensorrt_;
|
|
|
|
use_tensorrt_ = other.use_tensorrt_;
|
|
|
|
tensorrt_max_batchsize_ = other.tensorrt_max_batchsize_;
|
|
|
|
tensorrt_max_batchsize_ = other.tensorrt_max_batchsize_;
|
|
|
|
tensorrt_workspace_size_ = other.tensorrt_workspace_size_;
|
|
|
|
tensorrt_workspace_size_ = other.tensorrt_workspace_size_;
|
|
|
|
|
|
|
|
tensorrt_min_subgraph_size_ = other.tensorrt_min_subgraph_size_;
|
|
|
|
model_from_memory_ = other.model_from_memory_;
|
|
|
|
model_from_memory_ = other.model_from_memory_;
|
|
|
|
|
|
|
|
|
|
|
|
if (use_gpu) {
|
|
|
|
if (use_gpu) {
|
|
|
@ -89,6 +90,7 @@ contrib::AnalysisConfig::AnalysisConfig(contrib::AnalysisConfig &&other) {
|
|
|
|
use_tensorrt_ = other.use_tensorrt_;
|
|
|
|
use_tensorrt_ = other.use_tensorrt_;
|
|
|
|
tensorrt_max_batchsize_ = other.tensorrt_max_batchsize_;
|
|
|
|
tensorrt_max_batchsize_ = other.tensorrt_max_batchsize_;
|
|
|
|
tensorrt_workspace_size_ = other.tensorrt_workspace_size_;
|
|
|
|
tensorrt_workspace_size_ = other.tensorrt_workspace_size_;
|
|
|
|
|
|
|
|
tensorrt_min_subgraph_size_ = other.tensorrt_min_subgraph_size_;
|
|
|
|
model_from_memory_ = other.model_from_memory_;
|
|
|
|
model_from_memory_ = other.model_from_memory_;
|
|
|
|
|
|
|
|
|
|
|
|
pass_builder_ = std::move(other.pass_builder_);
|
|
|
|
pass_builder_ = std::move(other.pass_builder_);
|
|
|
@ -105,11 +107,13 @@ void contrib::AnalysisConfig::EnableMKLDNN() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void contrib::AnalysisConfig::EnableTensorRtEngine(int workspace_size,
|
|
|
|
void contrib::AnalysisConfig::EnableTensorRtEngine(int workspace_size,
|
|
|
|
int max_batch_size) {
|
|
|
|
int max_batch_size,
|
|
|
|
|
|
|
|
int min_subgraph_size) {
|
|
|
|
use_tensorrt_ = true;
|
|
|
|
use_tensorrt_ = true;
|
|
|
|
tensorrt_workspace_size_ = workspace_size;
|
|
|
|
tensorrt_workspace_size_ = workspace_size;
|
|
|
|
tensorrt_max_batchsize_ = max_batch_size;
|
|
|
|
tensorrt_max_batchsize_ = max_batch_size;
|
|
|
|
// Append after the infer_clean pass.
|
|
|
|
tensorrt_min_subgraph_size_ = min_subgraph_size;
|
|
|
|
|
|
|
|
// Append after the conv+affine_channel fuse pass.
|
|
|
|
pass_builder()->InsertPass(3, "tensorrt_subgraph_pass");
|
|
|
|
pass_builder()->InsertPass(3, "tensorrt_subgraph_pass");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|