all test ok
This commit is contained in:
@@ -124,7 +124,7 @@ namespace tk { namespace dnn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tk::dnn::Network *darknetAddNet(darknetFields_t &fields) {
|
tk::dnn::Network *darknetAddNet(darknetFields_t &fields) {
|
||||||
std::cout<<"Add Net: "<<fields.type<<"\n";
|
//std::cout<<"Add Net: "<<fields.type<<"\n";
|
||||||
dataDim_t dim(1, fields.channels, fields.height, fields.width);
|
dataDim_t dim(1, fields.channels, fields.height, fields.width);
|
||||||
return new tk::dnn::Network(dim);
|
return new tk::dnn::Network(dim);
|
||||||
}
|
}
|
||||||
@@ -138,10 +138,10 @@ namespace tk { namespace dnn {
|
|||||||
if(f.pad == 1) {
|
if(f.pad == 1) {
|
||||||
f.padding_x = f.padding_y = f.size_x /2;
|
f.padding_x = f.padding_y = f.size_x /2;
|
||||||
}
|
}
|
||||||
std::cout<<"Add layer: "<<f.type<<"\n";
|
//std::cout<<"Add layer: "<<f.type<<"\n";
|
||||||
if(f.type == "convolutional") {
|
if(f.type == "convolutional") {
|
||||||
std::string wgs = wgs_path + "/c" + std::to_string(netLayers.size()) + ".bin";
|
std::string wgs = wgs_path + "/c" + std::to_string(netLayers.size()) + ".bin";
|
||||||
printf("%d (%d,%d) (%d,%d) (%d,%d) %s %d %d\n", f.filters, f.size_x, f.size_y, f.stride_x, f.stride_y, f.padding_x, f.padding_y, wgs.c_str(), f.batch_normalize, f.groups);
|
//printf("%d (%d,%d) (%d,%d) (%d,%d) %s %d %d\n", f.filters, f.size_x, f.size_y, f.stride_x, f.stride_y, f.padding_x, f.padding_y, wgs.c_str(), f.batch_normalize, f.groups);
|
||||||
tk::dnn::Conv2d *l= new tk::dnn::Conv2d(net, f.filters, f.size_x, f.size_y, f.stride_x,
|
tk::dnn::Conv2d *l= new tk::dnn::Conv2d(net, f.filters, f.size_x, f.size_y, f.stride_x,
|
||||||
f.stride_y, f.padding_x, f.padding_y, wgs, f.batch_normalize, false, f.groups);
|
f.stride_y, f.padding_x, f.padding_y, wgs, f.batch_normalize, false, f.groups);
|
||||||
netLayers.push_back(l);
|
netLayers.push_back(l);
|
||||||
@@ -163,7 +163,7 @@ namespace tk { namespace dnn {
|
|||||||
if(layerIdx < 0)
|
if(layerIdx < 0)
|
||||||
layerIdx = netLayers.size() + layerIdx;
|
layerIdx = netLayers.size() + layerIdx;
|
||||||
if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to shortcut\n");
|
if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to shortcut\n");
|
||||||
std::cout<<"shortcut to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
|
//std::cout<<"shortcut to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
|
||||||
netLayers.push_back(new tk::dnn::Shortcut(net, netLayers[layerIdx]));
|
netLayers.push_back(new tk::dnn::Shortcut(net, netLayers[layerIdx]));
|
||||||
|
|
||||||
} else if(f.type == "upsample") {
|
} else if(f.type == "upsample") {
|
||||||
@@ -177,7 +177,7 @@ namespace tk { namespace dnn {
|
|||||||
if(layerIdx < 0)
|
if(layerIdx < 0)
|
||||||
layerIdx = netLayers.size() + layerIdx;
|
layerIdx = netLayers.size() + layerIdx;
|
||||||
if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to route\n");
|
if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to route\n");
|
||||||
std::cout<<"Route to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
|
//std::cout<<"Route to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
|
||||||
layers.push_back(netLayers[layerIdx]);
|
layers.push_back(netLayers[layerIdx]);
|
||||||
}
|
}
|
||||||
netLayers.push_back(new tk::dnn::Route(net, layers.data(), layers.size()));
|
netLayers.push_back(new tk::dnn::Route(net, layers.data(), layers.size()));
|
||||||
@@ -190,7 +190,7 @@ namespace tk { namespace dnn {
|
|||||||
|
|
||||||
} else if(f.type == "yolo") {
|
} else if(f.type == "yolo") {
|
||||||
std::string wgs = wgs_path + "/g" + std::to_string(netLayers.size()) + ".bin";
|
std::string wgs = wgs_path + "/g" + std::to_string(netLayers.size()) + ".bin";
|
||||||
printf("%d %d %s %d %f\n", f.classes, f.num/f.n_mask, wgs.c_str(), f.n_mask, f.scale_xy);
|
//printf("%d %d %s %d %f\n", f.classes, f.num/f.n_mask, wgs.c_str(), f.n_mask, f.scale_xy);
|
||||||
tk::dnn::Yolo *l = new tk::dnn::Yolo(net, f.classes, f.num/f.n_mask, wgs, f.n_mask, f.scale_xy);
|
tk::dnn::Yolo *l = new tk::dnn::Yolo(net, f.classes, f.num/f.n_mask, wgs, f.n_mask, f.scale_xy);
|
||||||
if(names.size() != f.classes)
|
if(names.size() != f.classes)
|
||||||
FatalError("Mismatch between number of classes and names");
|
FatalError("Mismatch between number of classes and names");
|
||||||
|
|||||||
@@ -106,14 +106,14 @@ class DetectionNN {
|
|||||||
originalSize.clear();
|
originalSize.clear();
|
||||||
if(TKDNN_VERBOSE) printCenteredTitle(" TENSORRT detection ", '=', 30);
|
if(TKDNN_VERBOSE) printCenteredTitle(" TENSORRT detection ", '=', 30);
|
||||||
{
|
{
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
for(int bi=0; bi<cur_batches;++bi){
|
for(int bi=0; bi<cur_batches;++bi){
|
||||||
if(!frames[bi].data)
|
if(!frames[bi].data)
|
||||||
FatalError("No image data feed to detection");
|
FatalError("No image data feed to detection");
|
||||||
originalSize.push_back(frames[bi].size());
|
originalSize.push_back(frames[bi].size());
|
||||||
preprocess(frames[bi], bi);
|
preprocess(frames[bi], bi);
|
||||||
}
|
}
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
if(save_times) *times<<t_ns<<";";
|
if(save_times) *times<<t_ns<<";";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,9 +122,9 @@ class DetectionNN {
|
|||||||
dim.n = cur_batches;
|
dim.n = cur_batches;
|
||||||
{
|
{
|
||||||
if(TKDNN_VERBOSE) dim.print();
|
if(TKDNN_VERBOSE) dim.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT->infer(dim, input_d);
|
netRT->infer(dim, input_d);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
if(TKDNN_VERBOSE) dim.print();
|
if(TKDNN_VERBOSE) dim.print();
|
||||||
stats.push_back(t_ns);
|
stats.push_back(t_ns);
|
||||||
if(save_times) *times<<t_ns<<";";
|
if(save_times) *times<<t_ns<<";";
|
||||||
@@ -132,10 +132,10 @@ class DetectionNN {
|
|||||||
|
|
||||||
batchDetected.clear();
|
batchDetected.clear();
|
||||||
{
|
{
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
for(int bi=0; bi<cur_batches;++bi)
|
for(int bi=0; bi<cur_batches;++bi)
|
||||||
postprocess(bi, mAP);
|
postprocess(bi, mAP);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
if(save_times) *times<<t_ns<<"\n";
|
if(save_times) *times<<t_ns<<"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ int testInference(std::vector<std::string> input_bins, std::vector<std::string>
|
|||||||
tk::dnn::dataDim_t dim1 = net->input_dim; //input dim
|
tk::dnn::dataDim_t dim1 = net->input_dim; //input dim
|
||||||
printCenteredTitle(" CUDNN inference ", '=', 30); {
|
printCenteredTitle(" CUDNN inference ", '=', 30); {
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net->infer(dim1, data);
|
net->infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
for(int i=0; i<outputs.size(); i++) cudnn_out[i] = outputs[i]->dstData;
|
for(int i=0; i<outputs.size(); i++) cudnn_out[i] = outputs[i]->dstData;
|
||||||
@@ -45,9 +45,9 @@ int testInference(std::vector<std::string> input_bins, std::vector<std::string>
|
|||||||
tk::dnn::dataDim_t dim2 = net->input_dim;
|
tk::dnn::dataDim_t dim2 = net->input_dim;
|
||||||
printCenteredTitle(" TENSORRT inference ", '=', 30); {
|
printCenteredTitle(" TENSORRT inference ", '=', 30); {
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT->infer(dim2, data);
|
netRT->infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
for(int i=0; i<outputs.size(); i++) rt_out[i] = (dnnType*)netRT->buffersRT[i+1];
|
for(int i=0; i<outputs.size(); i++) rt_out[i] = (dnnType*)netRT->buffersRT[i+1];
|
||||||
|
|||||||
@@ -39,15 +39,15 @@
|
|||||||
#define TKDNN_VERBOSE 0
|
#define TKDNN_VERBOSE 0
|
||||||
|
|
||||||
// Simple Timer
|
// Simple Timer
|
||||||
#define TIMER_START timespec start, end; \
|
#define TKDNN_TSTART timespec start, end; \
|
||||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||||
|
|
||||||
#define TIMER_STOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \
|
#define TKDNN_TSTOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \
|
||||||
double t_ns = ((double)(end.tv_sec - start.tv_sec) * 1.0e9 + \
|
double t_ns = ((double)(end.tv_sec - start.tv_sec) * 1.0e9 + \
|
||||||
(double)(end.tv_nsec - start.tv_nsec))/1.0e6; \
|
(double)(end.tv_nsec - start.tv_nsec))/1.0e6; \
|
||||||
if(show) std::cout<<col<<"Time:"<<std::setw(16)<<t_ns<<" ms\n"<<COL_END;
|
if(show) std::cout<<col<<"Time:"<<std::setw(16)<<t_ns<<" ms\n"<<COL_END;
|
||||||
|
|
||||||
#define TIMER_STOP TIMER_STOP_C(COL_CYANB, TKDNN_VERBOSE)
|
#define TKDNN_TSTOP TKDNN_TSTOP_C(COL_CYANB, TKDNN_VERBOSE)
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Prints the error message, and exits
|
* Prints the error message, and exits
|
||||||
|
|||||||
@@ -312,9 +312,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
cudnn_out = net.layers[net.num_layers-1]->dstData;
|
cudnn_out = net.layers[net.num_layers-1]->dstData;
|
||||||
@@ -326,9 +326,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
rt_out = (dnnType *)netRT.buffersRT[1];
|
rt_out = (dnnType *)netRT.buffersRT[1];
|
||||||
|
|||||||
@@ -301,9 +301,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
cudnn_out = net.layers[net.num_layers-1]->dstData;
|
cudnn_out = net.layers[net.num_layers-1]->dstData;
|
||||||
@@ -314,9 +314,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
rt_out = (dnnType *)netRT.buffersRT[1];
|
rt_out = (dnnType *)netRT.buffersRT[1];
|
||||||
|
|||||||
@@ -486,9 +486,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,9 +496,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -361,9 +361,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,9 +373,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ int main() {
|
|||||||
int ret_cudnn = 0;
|
int ret_cudnn = 0;
|
||||||
for(int i=0; i<N; i++) {
|
for(int i=0; i<N; i++) {
|
||||||
std::cout<<"i: "<<i<<"\n";
|
std::cout<<"i: "<<i<<"\n";
|
||||||
//TIMER_START
|
//TKDNN_TSTART
|
||||||
// Inference
|
// Inference
|
||||||
ImuNet.update(i0_h, i1_h, i2_h);
|
ImuNet.update(i0_h, i1_h, i2_h);
|
||||||
//TIMER_STOP
|
//TKDNN_TSTOP
|
||||||
|
|
||||||
// log path
|
// log path
|
||||||
path<<ImuNet.odomPOS(0)<<" "<<ImuNet.odomPOS(1)<<" "<< ImuNet.odomPOS(2)<<" ";
|
path<<ImuNet.odomPOS(0)<<" "<<ImuNet.odomPOS(1)<<" "<< ImuNet.odomPOS(2)<<" ";
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ int main() {
|
|||||||
|
|
||||||
std::cout<<"CUDNN inference:\n"; {
|
std::cout<<"CUDNN inference:\n"; {
|
||||||
dim.print(); //print initial dimension
|
dim.print(); //print initial dimension
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
out_data = net.infer(dim, data);
|
out_data = net.infer(dim, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim.print();
|
dim.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ int main() {
|
|||||||
|
|
||||||
std::cout<<"TENSORRT inference:\n"; {
|
std::cout<<"TENSORRT inference:\n"; {
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
out_data2 = netRT.infer(dim2, data);
|
out_data2 = netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ int main() {
|
|||||||
|
|
||||||
// Inference
|
// Inference
|
||||||
{
|
{
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
data = net.infer(dim, data);
|
data = net.infer(dim, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim.print();
|
dim.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,9 +157,9 @@ int main() {
|
|||||||
{
|
{
|
||||||
checkCuda(cudaMemcpyAsync(buffers[inputIndex], input_h, 1 * 28*28* sizeof(float), cudaMemcpyHostToDevice, stream));
|
checkCuda(cudaMemcpyAsync(buffers[inputIndex], input_h, 1 * 28*28* sizeof(float), cudaMemcpyHostToDevice, stream));
|
||||||
cudaStreamSynchronize(stream); //want to test only the inference time
|
cudaStreamSynchronize(stream); //want to test only the inference time
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
context->enqueue(1, buffers, stream, nullptr);
|
context->enqueue(1, buffers, stream, nullptr);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
checkCuda(cudaMemcpyAsync(output, buffers[outputIndex],10*sizeof(float), cudaMemcpyDeviceToHost, stream));
|
checkCuda(cudaMemcpyAsync(output, buffers[outputIndex],10*sizeof(float), cudaMemcpyDeviceToHost, stream));
|
||||||
cudaStreamSynchronize(stream);
|
cudaStreamSynchronize(stream);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,9 +477,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,9 +492,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -477,9 +477,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,9 +492,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -476,9 +476,9 @@ int main()
|
|||||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
net.infer(dim1, data);
|
net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,9 +491,9 @@ int main()
|
|||||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||||
{
|
{
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim2, data);
|
netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,18 +38,18 @@ int main() {
|
|||||||
tk::dnn::dataDim_t dim1 = dim; //input dim
|
tk::dnn::dataDim_t dim1 = dim; //input dim
|
||||||
printCenteredTitle(" CUDNN inference ", '=', 30); {
|
printCenteredTitle(" CUDNN inference ", '=', 30); {
|
||||||
dim1.print();
|
dim1.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
out_data = net.infer(dim1, data);
|
out_data = net.infer(dim1, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim1.print();
|
dim1.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
tk::dnn::dataDim_t dim2 = dim;
|
tk::dnn::dataDim_t dim2 = dim;
|
||||||
printCenteredTitle(" TENSORRT inference ", '=', 30); {
|
printCenteredTitle(" TENSORRT inference ", '=', 30); {
|
||||||
dim2.print();
|
dim2.print();
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
out_data2 = netRT.infer(dim2, data);
|
out_data2 = netRT.infer(dim2, data);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
dim2.print();
|
dim2.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ int main(int argc, char *argv[]) {
|
|||||||
checkCuda(cudaMemcpy(input_d, input, idim.tot()*sizeof(dnnType), cudaMemcpyHostToDevice));
|
checkCuda(cudaMemcpy(input_d, input, idim.tot()*sizeof(dnnType), cudaMemcpyHostToDevice));
|
||||||
|
|
||||||
tk::dnn::dataDim_t dim = idim;
|
tk::dnn::dataDim_t dim = idim;
|
||||||
TIMER_START
|
TKDNN_TSTART
|
||||||
netRT.infer(dim, input_d);
|
netRT.infer(dim, input_d);
|
||||||
TIMER_STOP
|
TKDNN_TSTOP
|
||||||
total_time+= t_ns;
|
total_time+= t_ns;
|
||||||
|
|
||||||
// control output
|
// control output
|
||||||
|
|||||||
Reference in New Issue
Block a user