I am aware tensor-flow.js is a web focused lib, but out of curiosity i tried it on react-native as well, it sort of works. It only works on debug-mode, and throws an error when debug-mood is turn off, the error says window.location.search is not an object. after some research i found that the window object is created in debug mode, but when out of debug mode it do not exist.
my understanding of this if somehow we can work around it, tfjs can also work on react-native, kind of like d3, the math part of the library works well with react but not the dom/svg manipulation part. for tfjs all we need is the math part for it to run on our mobile device, correct me if i am wrong.
https://github.com/tangtai/tensorflowJs-rn here is the repo of the project i created, it predicts a linear model and predict with with hardcoded value.
img of the application runs
img of error
I think there will be lots of possibilities if tfjs can run on react-native
The tensorflow-js team released an offical package for react-native
https://www.npmjs.com/package/@tensorflow/tfjs-react-native
if you want to run tensorflow on rn you should check it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With