#include #include #include "tkDNN/tkdnn.h" #include /* srand, rand */ int main(int argc, char *argv[]) { if(argc < 2 || !fileExist(argv[1])) FatalError("unable to read serialRT file"); int BATCH_SIZE = 1; if(argc >2) BATCH_SIZE = atoi(argv[2]); int NTEST = 100; if(argc >3) NTEST = atoi(argv[3]); //always same test srand (0); //convert network to tensorRT tk::dnn::NetworkRT netRT(NULL, argv[1]); tk::dnn::dataDim_t idim = netRT.input_dim; tk::dnn::dataDim_t odim = netRT.output_dim; idim.n = BATCH_SIZE; odim.n = BATCH_SIZE; dnnType *input = new float[idim.tot()]; dnnType *output = new float[odim.tot()]; dnnType *input_d; checkCuda( cudaMalloc(&input_d, idim.tot()*sizeof(dnnType))); int ret_tensorrt = 0; std::cout<<"Testing with batchsize: "< stats; printCenteredTitle(" TENSORRT inference ", '=', 30); float total_time = 0; for(int i=0; (NTEST > 0 ? i 1) stats.push_back(t_ns); // control output // std::cout<<"Output Buffers: "<