Write np array to checkpoint.
(var_name, np_db, checkpoint_path)
| 24 | |
| 25 | |
| 26 | def write_array_to_checkpoint(var_name, np_db, checkpoint_path): |
| 27 | """Write np array to checkpoint.""" |
| 28 | with tf.Graph().as_default(): |
| 29 | init_value = tf.py_func(lambda: np_db, [], tf.float32) |
| 30 | init_value.set_shape(np_db.shape) |
| 31 | tf_db = tf.get_variable(var_name, initializer=init_value) |
| 32 | saver = tf.train.Saver([tf_db]) |
| 33 | with tf.Session() as session: |
| 34 | session.run(tf.global_variables_initializer()) |
| 35 | saver.save(session, checkpoint_path) |
| 36 | |
| 37 | |
| 38 | def load_scann_searcher(var_name, |