小编aby*_*are的帖子

TensorFlow.js TensorCamera 错误:传递给“cast”的参数“x”必须是 Tensor 或 TensorLike,但得到“Tensor”

我正在使用 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)

python react-native tensorflow tensor tensorflow2.0

5
推荐指数
0
解决办法
384
查看次数

标签 统计

python ×1

react-native ×1

tensor ×1

tensorflow ×1

tensorflow2.0 ×1