-
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
TypeError: Cannot read property 'isTypedArray' of undefined, js engine: hermes #8482
Comments
Hi @kuldip-simform , I was able to run the code snippet you provided. It successfully creates tensors, and when running on a browser, it prints the tensor values. here is my package.json file.
Can you try with these dependencies that I am using. Also, clear your cache using npm cache clean --force after deleting your node_modules folder. Let me know if it works. Thank you! |
@shmishra99 Thank you for your response. I will try with this packages version |
Hi guys my package version is: "@tensorflow/tfjs": "^4.22.0", And i am facing same issue. |
@Tarun24RN Can you let me know what is your |
Yes,Here is my package.json dependencies:- "dependencies": { |
@Tarun24RN I had react-native-cli project and then I have added expo modules to run this library as it depends on expo modules. Have you done similar to this ? |
Yes, I have done same process. |
@kuldip-simform I found one file inside node-modules>@tensorflow>tjfs-react-native>dist export class PlatformReactNative {
/**
* Makes an HTTP request.
*
* see @fetch docs above.
*/
async fetch(path, init, options) {
return fetch(path, init, options);
}
/**
* Encode the provided string into an array of bytes using the provided
* encoding.
*/
encode(text, encoding) {
// See https://www.w3.org/TR/encoding/#utf-16le
if (encoding === 'utf-16') {
encoding = 'utf16le';
}
return new Uint8Array(Buffer.from(text, encoding));
}
/** Decode the provided bytes into a string using the provided encoding. */
decode(bytes, encoding) {
// See https://www.w3.org/TR/encoding/#utf-16le
if (encoding === 'utf-16') {
encoding = 'utf16le';
}
return Buffer.from(bytes).toString(encoding);
}
now() {
//@ts-ignore
if (global.nativePerformanceNow) {
//@ts-ignore
return global.nativePerformanceNow();
}
return Date.now();
}
setTimeoutCustom() {
throw new Error('react native does not support setTimeoutCustom');
}
isTypedArray(a) {
return a instanceof Float32Array || a instanceof Int32Array ||
a instanceof Uint8Array || a instanceof Uint8ClampedArray;
}
} May be because of this code tf.env().registerFlag('IS_REACT_NATIVE', () => navigator && navigator.product === 'ReactNative'); |
@Tarun24RN Maybe. This can be cause for this. I currently do not have project run. Can you try changing that and check if it solves issue? code goes here Thank you. |
I have tried by temporarily removing this check navigator.product === 'ReactNative' and then i rebuild the app but the error remain the same. |
Hi, I want to perform tensor calculation in my React Native project so I have added this package.
This is my package.json file:
This is my App.tsx:
When I just run
const ten = tf.zeros([2,2])
it runs properly and generates a proper tensor.Now I want to make my custom tensor from the data I provide with an array. At that time, I am getting the above-mentioned error. I have tried with
float32
,int32
,bool
,complex64
andstring
as well but nothing seems to work.This is information about my system and which versions I am running for different packages:
I am not sure if I am missing anything or doing anything wrong. Any help will be greatly appreciated
The text was updated successfully, but these errors were encountered: