MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / main

Function main

samples/python/efficientdet/infer_tf.py:122–146  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

120
121
122def main(args):
123 print("Running in benchmark mode")
124 tf_infer = TensorFlowInfer(args.saved_model)
125 input_size = [int(v) for v in args.input_size.split(",")]
126 assert len(input_size) == 2
127 tf_infer.override_input_shape(0, [args.batch_size, input_size[0], input_size[1], 3])
128 spec = tf_infer.input_spec()
129 batch = 255 * np.random.rand(*spec[0]).astype(spec[1])
130 iterations = 200
131 times = []
132 for i in range(20): # Warmup iterations
133 tf_infer.infer(batch)
134 for i in range(iterations):
135 start = time.time()
136 tf_infer.infer(batch)
137 times.append(time.time() - start)
138 print("Iteration {} / {}".format(i + 1, iterations), end="\r")
139 print("Benchmark results include TensorFlow host overhead")
140 print("Average Latency: {:.3f} ms".format(
141 1000 * np.average(times)))
142 print("Average Throughput: {:.1f} ips".format(
143 tf_infer.batch_size / np.average(times)))
144
145 print()
146 print("Finished Processing")
147
148
149if __name__ == "__main__":

Callers 1

infer_tf.pyFile · 0.70

Calls 6

override_input_shapeMethod · 0.95
input_specMethod · 0.95
inferMethod · 0.95
printFunction · 0.85
TensorFlowInferClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected