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

Discrepancy between browser concat and Node concat #6125

Closed
thekevinscott opened this issue Feb 13, 2022 · 1 comment · Fixed by #6824
Closed

Discrepancy between browser concat and Node concat #6125

thekevinscott opened this issue Feb 13, 2022 · 1 comment · Fixed by #6824
Assignees
Labels

Comments

@thekevinscott
Copy link
Contributor

thekevinscott commented Feb 13, 2022

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Macbook 2019 browser and Node
  • TensorFlow.js installed from (npm or script link): 3.13.0

Describe the current behavior
There is a discrepancy in the behavior of tf.concat between the browser and Node.

The following code works in the browser:

import * as tf from "@tensorflow/tfjs";

let ones = tf.ones([1, 2, 4, 3]);
let zeros = tf.zeros([1, 0, 2, 3]);
const final = zeros.concat(ones, 1);
console.log("final shape", final.shape);

In the console, this prints final shape (4) [1, 2, 4, 3].

The following code does not work in Node:

const tf = require("@tensorflow/tfjs-node");

let ones = tf.ones([1, 2, 4, 3]);
let zeros = tf.zeros([1, 0, 2, 3]);
const final = zeros.concat(ones, 1);
console.log(final.shape);

I get the following error:

            throw ex;
            ^

Error: Invalid TF_Status: 3
Message: ConcatOp : Dimensions of inputs should match: shape[0] = [1,0,2,3] vs. shape[1] = [1,2,4,3]

Describe the expected behavior
I would expect tf.concat to exhibit the same behavior on the browser and in Node.

Standalone code to reproduce the issue
Here is a link for the working browser code: https://codesandbox.io/s/tfjs-browser-concat-example-fie6e?file=/src/index.js
Here is a link for the failing Node code: https://codesandbox.io/s/tfjs-node-concat-example-frttt?file=/index.js

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

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

Successfully merging a pull request may close this issue.

3 participants