Commit bd35a856 authored by 赵威's avatar 赵威

try timer

parent 2b19cefa
...@@ -114,13 +114,19 @@ def model_predict2(device_id, diary_ids, device_dict, diary_dict, predict_fn): ...@@ -114,13 +114,19 @@ def model_predict2(device_id, diary_ids, device_dict, diary_dict, predict_fn):
tmp.update(device_info) tmp.update(device_info)
tmp.update(diary_info) tmp.update(diary_info)
features = {} features = {}
for (col, value) in tmp.items(): # for (col, value) in tmp.items():
if col in int_columns: # if col in int_columns:
features[col] = _int64_feature(int(value)) # features[col] = _int64_feature(int(value))
elif col in float_columns: # elif col in float_columns:
features[col] = _float_feature(float(value)) # features[col] = _float_feature(float(value))
elif col in str_columns: # elif col in str_columns:
features[col] = _bytes_feature(str(value).encode(encoding="utf-8")) # features[col] = _bytes_feature(str(value).encode(encoding="utf-8"))
for col in int_columns:
features[col] = _int64_feature(int(tmp[col]))
for col in float_columns:
features[col] = _float_feature(float(tmp[col]))
for col in str_columns:
features[col] = _bytes_feature(str(tmp[col]).encode(encoding="utf-8"))
example = tf.train.Example(features=tf.train.Features(feature=features)) example = tf.train.Example(features=tf.train.Features(feature=features))
examples.append(example.SerializeToString()) examples.append(example.SerializeToString())
total_1 = (timeit.default_timer() - time_1) 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