b);
            };

            request.onupgradeneeded = (event) => {
                db = event.target.result;
                if (!db.objectStoreNames.contains('tensors')) {
                    db.createObjectStore('tensors', { keyPath: 'id' });
                }
            };
        });
    }

    function saveTensorToDb(db, id, tensor) {
        return readTensorFromDb(db, id).then((result) => {
            if (!result) {
                new Promise((resolve, reject) => {
                    if (db =