我正在使用 React Native 跟踪cameraWithTensors 示例代码,但收到一个奇怪的错误,即相机张量是“Tensor”而不是 Tensor 或 TensoreLike
handleCameraStream(images, updatePreview, gl) {
const loop = async () => {
const nextImageTensor = images.next().value;
nextImageTensor.toFloat();
// throws [Error: Argument 'x' passed to 'cast' must be a Tensor or TensorLike, but got 'Tensor']
nextImageTensor.expandDims(0);
// throws [Error: Argument 'x' passed to 'expandDims' must be a Tensor or TensorLike, but got 'Tensor']
// Solved both of it using tf.func but my model is giving a similar error now
model.predict( tf.expandDims( tf.cast(nextImageTensor, …Run Code Online (Sandbox Code Playgroud)