-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
tfjs raises an error in Jest(unit testing) environment and Node.js runtime #7175
Labels
type:bug
Something isn't working
Comments
mattsoulanille
added a commit
to mattsoulanille/tfjs
that referenced
this issue
Dec 15, 2022
isTypedArray is implemented with `instanceof`, which does not work in jest (jestjs/jest#11864). Instead, use node's builtin `util.types.isUint8Array`, `util.types.isFloat32Array`, etc to perform this check. Fixes tensorflow#7175. This may also address tensorflow#7064, but it does not fix the root cause.
mattsoulanille
added a commit
that referenced
this issue
Dec 16, 2022
isTypedArray is implemented with `instanceof`, which does not work in jest (jestjs/jest#11864). Instead, use node's builtin `util.types.isUint8Array`, `util.types.isFloat32Array`, etc to perform this check. Fixes #7175. This may also address #7064, but it does not fix the root cause.
Linchenn
pushed a commit
to Linchenn/tfjs
that referenced
this issue
Jan 9, 2023
) isTypedArray is implemented with `instanceof`, which does not work in jest (jestjs/jest#11864). Instead, use node's builtin `util.types.isUint8Array`, `util.types.isFloat32Array`, etc to perform this check. Fixes tensorflow#7175. This may also address tensorflow#7064, but it does not fix the root cause.
mattsoulanille
added a commit
to mattsoulanille/tfjs
that referenced
this issue
Mar 16, 2023
A new function, `isTypedArray` was added to the `platform` interface by tensorflow#7181 and first published in tfjs-core 4.2.0. This made 4.2.0 incompatible with earlier versions of backends that implemented `platform`, such as node and react-native. This change adds a fallback to the use of `isTypedArray` so earlier versions of platforms that don't implement `isTypedArray` will not throw an error. Note that the behavior may not be perfect, such as when running Jest tests in node. See tensorflow#7175 for more details and upgrade all @tensorflow scoped packages to ^4.2.0 to avoid this. Fixes tensorflow#7273
mattsoulanille
added a commit
to mattsoulanille/tfjs
that referenced
this issue
Mar 16, 2023
A new function, `isTypedArray` was added to the `platform` interface by tensorflow#7181 and first published in tfjs-core 4.2.0. This made 4.2.0 incompatible with earlier versions of backends that implemented `platform`, such as node and react-native. This change adds a fallback to the use of `isTypedArray` so earlier versions of platforms that don't implement `isTypedArray` will not throw an error. Note that the fallback behavior may not be perfect, such as when running Jest tests in node. See tensorflow#7175 for more details and upgrade all @tensorflow scoped packages to ^4.2.0 to avoid this. Fixes tensorflow#7273
mattsoulanille
added a commit
that referenced
this issue
Mar 21, 2023
…#7489) A new function, `isTypedArray` was added to the `platform` interface by #7181 and first published in tfjs-core 4.2.0. This made 4.2.0 incompatible with earlier versions of backends that implemented `platform`, such as node and react-native. This change adds a fallback to the use of `isTypedArray` so earlier versions of platforms that don't implement `isTypedArray` will not throw an error. Note that the fallback behavior may not be perfect, such as when running Jest tests in node. See #7175 for more details and upgrade all @tensorflow scoped packages to ^4.2.0 to avoid this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
@tensorflow-models/coco-ssd
package to experiment with object detectionDescribe the current behavior
tensorflow js internals throw the following error when it used within jest test case.
Describe the expected behavior
Tests should pass.
The code works, it only fails in Jest.
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.
index.ts
index.spec.ts
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.
Traceback
Potentially relates to #545
The text was updated successfully, but these errors were encountered: