KerasToTensorRT icon indicating copy to clipboard operation
KerasToTensorRT copied to clipboard

tensorrt doesn't accelerate

Open AirFishWang opened this issue 5 years ago • 0 comments

Thanks for your demo, when I run the raw code, it looks work greatly, in order to verify the effect of tensorrt more precise, I add "warm-up" code before infer the graph. eg:

tf_engine = TfEngine(frozen_graph)
for i in range(warm_up):
    y_tf = tf_engine.infer(x_test)
t0 = time.time()
y_tf = tf_engine.infer(x_test)
t1 = time.time()
print('Tensorflow time', t1 - t0)
verify(y_tf, y_keras)

tftrt_engine = TftrtEngine(frozen_graph, batch_size, 'FP32')
for i in range(warm_up):
    y_tftrt = tftrt_engine.infer(x_test)
t0 = time.time()
y_tftrt = tftrt_engine.infer(x_test)
t1 = time.time()
print('TFTRT time', t1 - t0)
verify(y_tftrt, y_keras)

the test result show that tensorrt doesn't accelerate compared with the tensorflow infer process, I don't know why,

AirFishWang avatar May 05 '19 08:05 AirFishWang