Skip to content

Commit

Permalink
Merge pull request #119 from GiovanniFyc/patch-3
Browse files Browse the repository at this point in the history
Fix query num in trt cpp infer error
  • Loading branch information
Peterande authored Dec 19, 2024
2 parents 39b7c46 + 69ca210 commit 50e64e0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/inference/cppExample/trt/trtExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ void main(){
context->setInputShape(engine->getIOTensorName(1), nvinfer1::Dims2(1, 2));
context->executeV2(buffers);

float* hostScore = new float[1 * 4];
int64_t* hostLabel = new int64_t[1 * 4];
float* hostBoxes = new float[1 * 4 * 4];
float* hostScore = new float[1 * 300];
int64_t* hostLabel = new int64_t[1 * 300];
float* hostBoxes = new float[1 * 4 * 300];

cudaMemcpy(hostScore, score, 1 * 4 * sizeof(float), cudaMemcpyDeviceToHost);
cudaMemcpy(hostLabel, label, 1 * 4 * sizeof(int64_t), cudaMemcpyDeviceToHost);
cudaMemcpy(hostBoxes, boxes, 1 * 4 * 4 *sizeof(float), cudaMemcpyDeviceToHost);
cudaMemcpy(hostScore, score, 1 * 300 * sizeof(float), cudaMemcpyDeviceToHost);
cudaMemcpy(hostLabel, label, 1 * 300 * sizeof(int64_t), cudaMemcpyDeviceToHost);
cudaMemcpy(hostBoxes, boxes, 1 * 4 * 300 *sizeof(float), cudaMemcpyDeviceToHost);

for(int i=0;i<2;i++){
std::cout<<"score:"<<hostScore[i]<<" ";
Expand Down Expand Up @@ -123,4 +123,4 @@ void main(){
delete engine;
delete runtime;
std::cout<<"finish"<<std::endl;
}
}

0 comments on commit 50e64e0

Please sign in to comment.