MCPcopy Create free account
hub / github.com/google-research/language / write_array_to_checkpoint

Function write_array_to_checkpoint

language/orqa/utils/scann_utils.py:26–35  ·  view source on GitHub ↗

Write np array to checkpoint.

(var_name, np_db, checkpoint_path)

Source from the content-addressed store, hash-verified

24
25
26def 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
38def load_scann_searcher(var_name,

Callers

nothing calls this directly

Calls 2

runMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…