Copying within a storage medium, e.g.,
tf.io.copyModel('localstorage://model-1', 'localstorage://model-2')
Copying between two storage mediums, e.g.,
tf.io.copyModel('localstorage://model-1', 'indexeddb://model-1')
// First create and save a model. constmodel = tf.sequential(); model.add(tf.layers.dense( {units:1, inputShape: [10], activation:'sigmoid'})); awaitmodel.save('localstorage://demo/management/model1');
// Then list existing models. console.log(JSON.stringify(awaittf.io.listModels()));
// Copy the model, from Local Storage to IndexedDB. awaittf.io.copyModel( 'localstorage://demo/management/model1', 'indexeddb://demo/management/model1');
// List models again. console.log(JSON.stringify(awaittf.io.listModels()));
// Remove both models. awaittf.io.removeModel('localstorage://demo/management/model1'); awaittf.io.removeModel('indexeddb://demo/management/model1');
Copy a model from one URL to another.
This function supports:
tf.io.copyModel('localstorage://model-1', 'localstorage://model-2')
tf.io.copyModel('localstorage://model-1', 'indexeddb://model-1')