This commit is contained in:
2022-09-02 14:15:54 +00:00
parent ee8f1cb68c
commit 977e49900d
16 changed files with 2241 additions and 272 deletions
+7 -1
View File
@@ -196,4 +196,10 @@ def sparse_to_tensor(L):
idx = np.mat([L.row, L.col]).transpose().astype(np.float32)
data = L.data.astype(dtype=np.float32)
shape = L.shape
return tf.SparseTensor(idx, data, shape)
return tf.SparseTensor(idx, data, shape)
def load_model(model, checkpoint):
ckpt = tf.train.Checkpoint(model=model)
manager = tf.train.CheckpointManager(ckpt, checkpoint, max_to_keep=1)
ckpt.restore(manager.latest_checkpoint)