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

Function time_test

examples/tensorflow/common_utils/common.py:76–89  ·  view source on GitHub ↗
(sess, tensor, iterations=100, warmup=True)

Source from the content-addressed store, hash-verified

74 return tf.truncated_normal_initializer(stddev=initializer_range, dtype=data_type)
75
76def time_test(sess, tensor, iterations=100, warmup=True):
77 # return in ms
78
79 # warmup
80 if warmup == True:
81 for i in range(iterations):
82 sess.run(tensor)
83
84 t1 = datetime.now()
85 for i in range(iterations):
86 sess.run(tensor)
87 t2 = datetime.now()
88 time_sum = (t2 - t1).total_seconds()
89 return time_sum * 1000 / iterations
90
91def cross_check(name, tf_val, op_val, atol_threshold):
92 abs_diff = np.fabs(tf_val - op_val)

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected