Commit ec0e0f7f authored by 张彦钊's avatar 张彦钊

change float to int

parent 38beeac6
...@@ -29,18 +29,18 @@ def gen_tfrecords(in_file): ...@@ -29,18 +29,18 @@ def gen_tfrecords(in_file):
for i in range(df.shape[0]): for i in range(df.shape[0]):
features = tf.train.Features(feature={ features = tf.train.Features(feature={
"y": tf.train.Feature(float_list=tf.train.FloatList(value=[df["y"][i]])), "y": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["y"][i]])),
"z": tf.train.Feature(float_list=tf.train.FloatList(value=[df["z"][i]])), "z": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["z"][i]])),
"top": tf.train.Feature(float_list=tf.train.FloatList(value=[df["top"][i]])), "top": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["top"][i]])),
"channel": tf.train.Feature(float_list=tf.train.FloatList(value=[df["channel"][i]])), "channel": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["channel"][i]])),
"ucity_id": tf.train.Feature(float_list=tf.train.FloatList(value=[df["ucity_id"][i]])), "ucity_id": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["ucity_id"][i]])),
"clevel1_id": tf.train.Feature(float_list=tf.train.FloatList(value=[df["clevel1_id"][i]])), "clevel1_id": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["clevel1_id"][i]])),
"ccity_name": tf.train.Feature(float_list=tf.train.FloatList(value=[df["ccity_name"][i]])), "ccity_name": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["ccity_name"][i]])),
"device_type": tf.train.Feature(float_list=tf.train.FloatList(value=[df["device_type"][i]])), "device_type": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["device_type"][i]])),
"manufacturer": tf.train.Feature(float_list=tf.train.FloatList(value=[df["manufacturer"][i]])), "manufacturer": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["manufacturer"][i]])),
"level2_ids": tf.train.Feature(float_list=tf.train.FloatList(value=[df["level2_ids"][i]])), "level2_ids": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["level2_ids"][i]])),
"time": tf.train.Feature(float_list=tf.train.FloatList(value=[df["time"][i]])), "time": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["time"][i]])),
"stat_date": tf.train.Feature(float_list=tf.train.FloatList(value=[df["stat_date"][i]])) "stat_date": tf.train.Feature(int64_list=tf.train.Int64List(value=[df["stat_date"][i]]))
}) })
example = tf.train.Example(features = features) example = tf.train.Example(features = features)
...@@ -62,4 +62,4 @@ def main(_): ...@@ -62,4 +62,4 @@ def main(_):
if __name__ == "__main__": if __name__ == "__main__":
tf.logging.set_verbosity(tf.logging.INFO) tf.logging.set_verbosity(tf.logging.INFO)
tf.app.run() tf.app.run()
\ No newline at end of file
...@@ -51,18 +51,18 @@ def input_fn(filenames, batch_size=32, num_epochs=1, perform_shuffle=False): ...@@ -51,18 +51,18 @@ def input_fn(filenames, batch_size=32, num_epochs=1, perform_shuffle=False):
print('Parsing', filenames) print('Parsing', filenames)
def _parse_fn(record): def _parse_fn(record):
features = { features = {
"y": tf.FixedLenFeature([], tf.float32), "y": tf.FixedLenFeature([], tf.int64),
"z": tf.FixedLenFeature([], tf.float32), "z": tf.FixedLenFeature([], tf.int64),
"top": tf.FixedLenFeature([], tf.float32), "top": tf.FixedLenFeature([], tf.int64),
"channel": tf.FixedLenFeature([], tf.float32), "channel": tf.FixedLenFeature([], tf.int64),
"ucity_id": tf.FixedLenFeature([], tf.float32), "ucity_id": tf.FixedLenFeature([], tf.int64),
"clevel1_id": tf.FixedLenFeature([], tf.float32), "clevel1_id": tf.FixedLenFeature([], tf.int64),
"ccity_name": tf.FixedLenFeature([], tf.float32), "ccity_name": tf.FixedLenFeature([], tf.int64),
"device_type": tf.FixedLenFeature([], tf.float32), "device_type": tf.FixedLenFeature([], tf.int64),
"manufacturer": tf.FixedLenFeature([], tf.float32), "manufacturer": tf.FixedLenFeature([], tf.int64),
"level2_ids": tf.FixedLenFeature([], tf.float32), "level2_ids": tf.FixedLenFeature([], tf.int64),
"time": tf.FixedLenFeature([], tf.float32), "time": tf.FixedLenFeature([], tf.int64),
"stat_date": tf.FixedLenFeature([], tf.float32) "stat_date": tf.FixedLenFeature([], tf.int64)
} }
parsed = tf.parse_single_example(record, features) parsed = tf.parse_single_example(record, features)
......
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