Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort computation? #260

Open
javierluraschi opened this issue Jan 27, 2022 · 0 comments
Open

Abort computation? #260

javierluraschi opened this issue Jan 27, 2022 · 0 comments

Comments

@javierluraschi
Copy link

javierluraschi commented Jan 27, 2022

Obviously, JavaScript does not support aborting ongoing computations unless they run outside the main thread, say worker role, etc.

However, would it be possible to implement a hook to abort computation when possible? I can try to send a PR if this might be possible and get a code pointer.

For instance, tensorflow.js's fit() function supports this: https://stackoverflow.com/questions/57660245/is-there-a-way-to-abort-a-call-to-model-fit

await model.fit(x, y, {
    callbacks: {
        onBatchEnd: (batch, logs) => { // stop after batch
            if (/* ... */) {
                model.stopTraining = true;
            }
        },
        onEpochEnd: (epoch, logs) => { // stop after epoch
            if (/* ... */) {
                model.stopTraining = true;
            }
        },
    },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant