Commit e9340e07 authored by 赵威's avatar 赵威

add timer

parent 79a750fa
......@@ -92,6 +92,7 @@ def _bytes_feature(value):
def model_predict(inputs, predict_fn):
time_1 = timeit.default_timer()
int_columns = [
"active_type", "active_days", "card_id", "is_pure_author", "is_have_reply", "is_have_pure_reply", "content_level",
"topic_num", "favor_num", "vote_num"
......@@ -111,6 +112,9 @@ def model_predict(inputs, predict_fn):
features[col] = _bytes_feature(str(value).encode(encoding="utf-8"))
example = tf.train.Example(features=tf.train.Features(feature=features))
examples.append(example.SerializeToString())
total_1 = (timeit.default_timer() - time_1)
print("make example cost {:.5f}s".format(total_1))
time_1 = timeit.default_timer()
predictions = predict_fn({"examples": examples})
total_1 = (timeit.default_timer() - time_1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment