【问题标题】:Why am I getting the error "tf.fromPixels is not a function"?为什么我收到错误“tf.fromPixels 不是函数”?
【发布时间】:2019-08-19 12:23:38
【问题描述】:

我有一些基本的 tensorflow.js 代码from an example on the documentation

const image = new ImageData(1, 1);
image.data[0] = 100;
image.data[1] = 150;
image.data[2] = 200;
image.data[3] = 255;
const xs = tf.fromPixels(image);
xs.print();
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.0.0/dist/tf.min.js"></script>

使用此版本(网站告诉您使用的版本):

https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.0.0/dist/tf.min.js

并得到错误:Uncaught TypeError: tf.fromPixels is not a function 可能导致这种情况的原因是什么?运行 sn-p 时其他人是否收到此错误?

【问题讨论】:

  • 在多个浏览器中测试,同样的错误。
  • 我对张量流知之甚少,虽然:你有没有看过 tf 中的内容?因为 JS 很少撒谎。

标签: javascript tensorflow tensorflow.js


【解决方案1】:

您正在查看 0.12.0 版的文档。

tf.fromPixels 在 1.0.0 版本中被弃用,使用:tf.browser.fromPixels()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-04
    • 2019-10-14
    • 2023-01-24
    • 2011-01-03
    • 2022-08-03
    • 1970-01-01
    • 2017-01-10
    • 1970-01-01
    相关资源
    最近更新 更多