We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
To get help from the community, check out our Google group.
0.11.8
irrelevant
tf.oneHot returns a tensor of dtype 'float32' with some backends, and with dtype 'int32' in other backends.
describeWithFlags('oneHotType', ALL_ENVS, () => { expectedType = 'int32' fit('Output type is what', () => { const indices = tf.tensor1d([0, 1], 'int32'); const res = tf.oneHot(indices, 2); console.log("XXXXXXXXXXXXXXXX"); console.log(res.dtype); expect(res.dtype).toEqual(expectedType); }); });
outputs
LOG: 'XXXXXXXXXXXXXXXX' LOG: 'int32' LOG: 'XXXXXXXXXXXXXXXX' LOG: 'int32' LOG: 'XXXXXXXXXXXXXXXX' LOG: 'float32' Chrome 67.0.3396 (Linux 0.0.0) oneHot {"BACKEND":"test-cpu"} Output type is int32 FAILED Expected 'float32' to equal 'int32'. at <Jasmine> at UserContext.<anonymous> (src/ops/array_ops_test.ts:2171:22 <- src/ops/array_ops_test.js:7084:39) at <Jasmine>
The text was updated successfully, but these errors were encountered:
@bileschi Looks like CPU backend was using default float32 as dtype. Providing int32 as dtype to output fixes it.
float32
dtype
int32
Sorry, something went wrong.
One Hot: Fixes CPU result dtype (#1110)
833475d
BUG: tensorflow/tfjs#435
Successfully merging a pull request may close this issue.
To get help from the community, check out our Google group.
TensorFlow.js version
0.11.8
Browser version
irrelevant
Describe the problem or feature request
tf.oneHot returns a tensor of dtype 'float32' with some backends, and with dtype 'int32' in other backends.
Code to reproduce the bug / link to feature request
outputs
The text was updated successfully, but these errors were encountered: