@@ -538,9 +538,18 @@ bool ApplyProfileShapesFromProviderOptions(std::vector<nvinfer1::IOptimizationPr
538538 input_explicit_shape_ranges[input_name][static_cast <int64_t >(j)][i].push_back (opt_value);
539539 }
540540
541+ #if (NV_TENSORRT_MAJOR == 10 && NV_TENSORRT_MINOR > 10) || NV_TENSORRT_MAJOR > 10
542+ std::vector<int64_t > shapes_min_64 (shapes_min.begin (), shapes_min.end ());
543+ std::vector<int64_t > shapes_opt_64 (shapes_opt.begin (), shapes_opt.end ());
544+ std::vector<int64_t > shapes_max_64 (shapes_max.begin (), shapes_max.end ());
545+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN , &shapes_min_64[0 ], shape_size);
546+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX , &shapes_opt_64[0 ], shape_size);
547+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT , &shapes_max_64[0 ], shape_size);
548+ #else
541549 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN , &shapes_min[0 ], shape_size);
542550 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX , &shapes_max[0 ], shape_size);
543551 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT , &shapes_opt[0 ], shape_size);
552+ #endif
544553 }
545554 // Execution tensor
546555 else {
@@ -627,6 +636,17 @@ Status ApplyProfileShapesFromInputTensorValue(std::vector<nvinfer1::IOptimizatio
627636 if (input->isShapeTensor ()) {
628637 // shape tensor
629638 int shape_size = nb_dims == 0 ? 1 : static_cast <int >(tensor_shapes[0 ]);
639+ #if (NV_TENSORRT_MAJOR == 10 && NV_TENSORRT_MINOR > 10) || NV_TENSORRT_MAJOR > 10
640+ std::vector<int64_t > shapes_min (shape_size), shapes_opt (shape_size), shapes_max (shape_size);
641+ for (int j = 0 ; j < shape_size; j++) {
642+ shapes_min[j] = *(trt_profiles[0 ]->getShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN ));
643+ shapes_max[j] = *(trt_profiles[0 ]->getShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX ));
644+ shapes_opt[j] = *(trt_profiles[0 ]->getShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT ));
645+ }
646+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN , &shapes_min[0 ], shape_size);
647+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX , &shapes_max[0 ], shape_size);
648+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT , &shapes_opt[0 ], shape_size);
649+ #else
630650 std::vector<int32_t > shapes_min (shape_size), shapes_opt (shape_size), shapes_max (shape_size);
631651 for (int j = 0 ; j < shape_size; j++) {
632652 shapes_min[j] = *(trt_profiles[0 ]->getShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN ));
@@ -636,6 +656,7 @@ Status ApplyProfileShapesFromInputTensorValue(std::vector<nvinfer1::IOptimizatio
636656 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN , &shapes_min[0 ], shape_size);
637657 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX , &shapes_max[0 ], shape_size);
638658 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT , &shapes_opt[0 ], shape_size);
659+ #endif
639660 } else {
640661 // execution tensor
641662 nvinfer1::Dims dims_min, dims_opt, dims_max;
@@ -733,10 +754,18 @@ Status ApplyProfileShapesFromInputTensorValue(std::vector<nvinfer1::IOptimizatio
733754 }
734755 *engine_update = true ;
735756 }
736-
757+ #if (NV_TENSORRT_MAJOR == 10 && NV_TENSORRT_MINOR > 10) || NV_TENSORRT_MAJOR > 10
758+ std::vector<int64_t > shapes_min_64 (shapes_min.begin (), shapes_min.end ());
759+ std::vector<int64_t > shapes_opt_64 (shapes_opt.begin (), shapes_opt.end ());
760+ std::vector<int64_t > shapes_max_64 (shapes_max.begin (), shapes_max.end ());
761+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN , &shapes_min_64[0 ], shape_size);
762+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX , &shapes_opt_64[0 ], shape_size);
763+ trt_profile->setShapeValuesV2 (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT , &shapes_max_64[0 ], shape_size);
764+ #else
737765 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMIN , &shapes_min[0 ], shape_size);
738766 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kMAX , &shapes_max[0 ], shape_size);
739767 trt_profile->setShapeValues (input_name.c_str (), nvinfer1::OptProfileSelector::kOPT , &shapes_opt[0 ], shape_size);
768+ #endif
740769 } else { // Execution tensor
741770 nvinfer1::Dims dims_min (dims), dims_opt (dims), dims_max (dims);
742771 for (int j = 0 , end = nb_dims; j < end; ++j) {
0 commit comments