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

tf.euclideanNormof returns different outputs across all backends #8398

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

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

tf.euclideanNormof returns different outputs across all backends.
Output:
image
image

Describe the expected behavior
The output should be consistent across all backends.

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.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>bug00</title>
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.js"> </script>
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-backend-wasm.js"></script>
</head>
<body>

<script>
    async function euclideanNorm(backend){
        await tf.setBackend(backend);
        await tf.ready() 
       var x = [[1417279172.7134323,-962121950.6599674,-1437010574.2808547,2095674143.2008529,1427796998.6757426,1887412658.2202978,-1044244790.2026412,-925228044.7582364],[199098629.4556465,2033330803.4782395,-1137622881.741169,1464222243.8594966,1244670529.977944,585715582.9707108,-451702244.20557237,1229751836.850954],[-561844250.0064993,1354901645.4631453,-11485725.867771864,1888701629.1326509,1944947959.4554725,671298902.6714282,-1081777974.652852,2116462290.2700758],[-224132249.8358903,1431340210.9772592,1464451296.7952642,-1670163394.3936162,-2078814304.6784964,1444455836.2976499,-311208064.88376045,1510256834.1648817],[-321475144.59195495,453155931.4206462,1335958128.2944093,2145032021.9482574,1949246855.7539525,-1219125638.1810377,1212915733.8217373,1318621794.4393039],[778060113.0395575,283529696.1077938,-87281015.37935948,-56064210.95383453,-1531860921.6216698,-1959419224.738887,-245244226.09076762,283710421.3469815],[825519265.0907207,-2028958641.446673,-1957632132.1793337,2087128031.3359342,-310266712.38287115,-1951317661.3591979,2054410551.5675068,-2115824670.7492585]]
       var axis=-1
       var result = await tf.euclideanNorm(x, axis);
        await console.log("the result of ", tf.getBackend(), "is:\n" );
        await result.print();
    }
    async function test() {
        await euclideanNorm("cpu");
        await euclideanNorm("webgl");
        await euclideanNorm("wasm");
    }
    
    test();
</script>
</body>
</html>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants