MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / time_test

Function time_test

examples/tensorflow/decoder/utils/common.py:260–273  ·  view source on GitHub ↗
(sess, tensor, iterations=100, warmup=True)

Source from the content-addressed store, hash-verified

258 return tf.TensorShape(shape)
259
260def time_test(sess, tensor, iterations=100, warmup=True):
261 # return in ms
262
263 # warmup
264 if warmup == True:
265 for i in range(iterations):
266 sess.run(tensor)
267
268 t1 = datetime.now()
269 for i in range(iterations):
270 sess.run(tensor)
271 t2 = datetime.now()
272 time_sum = (t2 - t1).total_seconds()
273 return time_sum * 1000 / iterations
274
275def cross_check(name, tf_val, op_val, atol_threshold):
276 abs_diff = np.fabs(tf_val - op_val)

Callers 2

decoder_example.pyFile · 0.90

Calls 1

runMethod · 0.45

Tested by

no test coverage detected