-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
Description
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): no
- OS Platform for development: Windows 10, RN expo SDK
- Mobile device: Android 10, Huawei P30 pro
- TensorFlow.js installed from: npm
- TensorFlow.js version: ^4.0.0
- Tensorflow.js react-native version: ^0.8.0
Describe the current behavior
on android, type of images.next().value is 'Tensor', not Tensor or TensorLike. It results in error " Error: Argument "x" passed to 'conv2d' must be a Tensor or TensorLike, but got 'tensor' "
Describe the expected behavior
should work the same as on iOS
Problem happens only with Hermes JS engine
Standalone code to reproduce the issue
import { dispose, Tensor3D } from "@tensorflow/tfjs";
import { cameraWithTensors } from "@tensorflow/tfjs-react-native";
export const ExampleComponent = () => {
const handleCameraStream = useCallback(
(images: IterableIterator<Tensor3D>) => {
const loop = async () => {
const tensor = images.next().value;
detectGesture(tensor); // error happens here, model predict is called inside and specified error occurs
},
[isGestureDetectionReady]
);
return
<TensorCamera
type={CameraType.front}
cameraTextureHeight={640}
cameraTextureWidth={640}
resizeHeight={640}
resizeWidth={640}
onReady={handleCameraStream}
autorender={true}
/>
}
<TensorCamera
type={CameraType.front}
autoFocus={false}
pictureSize={pictureSize}
style={{
position: "absolute",
left: 50,
top: 100,
width: 120,
height: 120,
zIndex: 1,
borderWidth: 1,
borderColor: "black",
borderRadius: 0,
}}
cameraTextureHeight={640}
cameraTextureWidth={640}
resizeHeight={640}
resizeWidth={640}
zoom={0}
onReady={handleCameraStream}
autorender={true}
/>