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

The outputs of the tf.dot operation on theWasm backend are inconsistent with the output on the TensorFlow backend #8396

Open
liliquan0118 opened this issue Oct 2, 2024 · 0 comments
Assignees
Labels

Comments

@liliquan0118
Copy link

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04, Macos 13.3 (22E252)
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow.js installed from (npm or script link): script link
  • TensorFlow.js version (use command below): 4.2.0
  • Browser version: Chrome Version 128.0.6613.86 (Official Build) (arm64)
  • Tensorflow.js Converter Version:

Describe the current behavior

Given the "t1": [[1289328924.64505,2051092337.6925373,173654905.43031645,2100669721.3770614],[701451708.9475408,-1034240466.2648284,-1554255981.663638,-1773384464.5712419]], "t2": [[-1434384320.1547623,-595326783.14995],[382591937.3909383,1406908466.487136],[1124709131.724626,-244281148.61611748],[1217546997.2704406,-1925705365.3955224]], tf.dot(t1,t2) return [[1688313573467488300 , -1969564662122938400], [-5309108442948960000, 1922016968974532600 ]] on the Wasm backend. However, tf.dot(t1,t2) return [[1688313573467488300 , -1969564524683985000], [-5309108442948960000, 1922016968974532600 ]] on the tensorflow backend.

Output:
image

image

Describe the expected behavior

Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/CodePen/any notebook.

async function dot(backend){
    await tf.setBackend(backend);
    await tf.ready() 
    t1 = [[1289328924.64505,2051092337.6925373,173654905.43031645,2100669721.3770614],[701451708.9475408,-1034240466.2648284,-1554255981.663638,-1773384464.5712419]]
    t2 = [[-1434384320.1547623,-595326783.14995],[382591937.3909383,1406908466.487136],[1124709131.724626,-244281148.61611748],[1217546997.2704406,-1925705365.3955224]]
    const result = await tf.dot(t1,t2);
    await console.log("the result of ", tf.getBackend(), "is:\n" );
    await result.print();
}
async function test() {
    await dot("cpu");
    await dot("tensorflow");
    // await dot("wasm");
}

test();

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

@liliquan0118 liliquan0118 added the type:bug Something isn't working label Oct 2, 2024
@shmishra99 shmishra99 self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants