• Move a model from one URL to another.

    This function supports:

    1. Moving within a storage medium, e.g., tf.io.moveModel('localstorage://model-1', 'localstorage://model-2')
    2. Moving between two storage mediums, e.g., tf.io.moveModel('localstorage://model-1', 'indexeddb://model-1')
    // First create and save a model.
    const model = tf.sequential();
    model.add(tf.layers.dense(
    {units: 1, inputShape: [10], activation: 'sigmoid'}));
    await model.save('localstorage://demo/management/model1');

    // Then list existing models.
    console.log(JSON.stringify(await tf.io.listModels()));

    // Move the model, from Local Storage to IndexedDB.
    await tf.io.moveModel(
    'localstorage://demo/management/model1',
    'indexeddb://demo/management/model1');

    // List models again.
    console.log(JSON.stringify(await tf.io.listModels()));

    // Remove the moved model.
    await tf.io.removeModel('indexeddb://demo/management/model1');

    Parameters

    • sourceURL: string

      Source URL of moving.

    • destURL: string

      Destination URL of moving.

    Returns Promise<ModelArtifactsInfo>

    ModelArtifactsInfo of the copied model (if and only if copying is successful).

    Error if moving fails, e.g., if no model exists at sourceURL, or if oldPath and newPath are identical.

MMNEPVFCICPMFPCPTTAAATR