【发布时间】:2022-12-12 14:07:31
【问题描述】:
我按照所有说明安装@tensorflow/tfjs-react-native https://www.npmjs.com/package/@tensorflow/tfjs-react-native/v/0.3.0
这是我的 app.js 文件:
import React, { useState, useEffect } from 'react';
import * as tf from '@tensorflow/tfjs';
import '@tensorflow/tfjs-react-native';
import {
SafeAreaView,
StatusBar,
StyleSheet,
Text,
View,
} from 'react-native';
export default () => {
const [ready, setReady] = useState(false)
useEffect(() => {
const load = async () => {
await tf.ready()
setReady(true)
}
load()
})
return (
<SafeAreaView style={{ backgroundColor: '#fff', flex: 1 }}>
<StatusBar barStyle={'dark-content'} />
<View>
<Text>hello</Text>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
});
调用 tf.ready() 时应用程序崩溃。控制台中未记录任何错误。 如果我评论 tf.ready() 一切正常。难道我做错了什么?
这是我的 package.json 文件
image of package.json file 我如何测试这个包是否安装正确? 您身边的任何帮助将不胜感激。
【问题讨论】:
标签: react-native tensorflow tensorflow.js tfjs-node