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

meanSquaredError Of Two int32 Tensors Fails #934

Closed
dsanders11 opened this issue Nov 21, 2018 · 0 comments · Fixed by tensorflow/tfjs-core#1432
Closed

meanSquaredError Of Two int32 Tensors Fails #934

dsanders11 opened this issue Nov 21, 2018 · 0 comments · Fixed by tensorflow/tfjs-core#1432
Assignees
Labels
comp:core type:support user support questions

Comments

@dsanders11
Copy link
Contributor

To get help from the community, check out our Google group.

TensorFlow.js version

0.13.3

Describe the problem or feature request

const tensor1 = tf.fromPixels(canvas, 1);
const tensor2 = tf.fromPixels(canvas, 1);

const mse = tf.losses.meanSquaredError(tensor1, tensor2);

Results in:

Error: The dtypes of the first(int32) and second(float32) input must match

This does work:

const mse = tf.losses.meanSquaredError(tensor1.toFloat(), tensor2.toFloat());

Code to reproduce the bug / link to feature request

http://jsfiddle.net/5c94d3tf/

@rthadur rthadur added comp:core type:support user support questions labels Nov 26, 2018
dsmilkov added a commit to tensorflow/tfjs-core that referenced this issue Dec 6, 2018
Allow users to provide different dtypes in binary arithmetic ops (add/sub/mul/div/...) and matmul, just like in numpy.

The dtype of the result is upcasted i.e. matMul(float32, int32) => float32

This will result in release patch 0.14.1, which will fix the breakage in 0.14.0 caused by #1408 due to improved dtype inference where tensor(new Int32Array()) is inferred to be int32, and was float32.

Fixes tensorflow/tfjs#934, tensorflow/tfjs#966
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:core type:support user support questions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants