-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
Description
System information
- OS Platform and Distribution: Linux Mint / Chrome + Firefox
- TensorFlow.js version:
tf.version_core == "4.6.0"
- Browser version: Version 113.0.5672.126 (Offizieller Build) (64-Bit)
Describe the current behavior
Code crashes with: Uncaught (in promise) TypeError: u[1].flatten is not a function
:
Describe the expected behavior
Code does not crash, it should work like in node
.
Standalone code to reproduce the issue
testFlattenBug.html
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-layers"></script>
<script>
tf.setBackend('webgl').then(testBug);
function testBug() {
const numEncoderTokens = 49;
const latentDim = 256;
const encoderInputs = tf.layers.input({
shape: [null, numEncoderTokens] /*as number[]*/,
name: 'encoderInputs',
});
const encoder = tf.layers.lstm({
units: latentDim,
returnState: true,
name: 'encoderLstm',
});
const [, stateH, stateC] = encoder.apply(encoderInputs) /*as tf.SymbolicTensor[]*/;
}
</script>
Other info / logs
I converted simply this example to run in the browser:
It works in node
itself, but why would it fail in the browser with such a JS bug?