【问题标题】:How to import specific version of Tensorflow.js?如何导入特定版本的 Tensorflow.js?
【发布时间】:2019-05-20 21:09:16
【问题描述】:

我正在尝试将 TensorFlow 库集成到我的 IDE 中,以便使用它进行训练。

我去了这个网站:https://www.tensorflow.org/js/tutorials/setup,看起来我得到了最新最好的版本:

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.0.0/dist/tf.min.js"></script>

但是,由于它在我的代码编辑器中输出 tf 对象的方式,该版本无法正常工作。

我正在寻找接近这个版本的东西:

但是正如您所看到的,这让我很困惑,它到底是哪一个?当我在控制台中调出versions 属性时,我只看到了1.0.0,所以我不确定我在寻找什么版本,但它是你在上面或附近看到的任何输出。

重要的是我在我的 IDE 中写出来:

const data = tf.tensor([1,2,3]);
const otherData = tf.tensor([4,5,6]);

data.add(otherData);

我应该看到这个: [5, 7, 9] 输出了,但是我看到了这个:

{"isDisposedInternal":false,"shape":[3],"dtype":"float32","size":3,"strides":[],"dataId":{},"id":267,"rankType":"1"}

【问题讨论】:

    标签: tensorflow tensorflow.js


    【解决方案1】:

    您正在寻找 tensor.print()。

    如果真的需要改版本,只需要在script标签的src属性中改一下即可。

    【讨论】:

    • 塞巴斯蒂安,我试过tf.tensor.print(data.add(otherData));,但这对我不起作用。我也尝试过这种方式tf.Print(data.add(otherData))。你具体是怎么用的?
    • 我也试过这样tensor.print(data.add(otherData))
    • 你必须使用 data.print() 和 data.add(otherData).print()
    • 是的,这个data.add(otherData).print(); 不会在我的 IDE 上打印任何内容。
    • 它将它打印到标准输出。
    猜你喜欢
    • 2019-05-30
    • 1970-01-01
    • 1970-01-01
    • 2015-01-08
    • 1970-01-01
    • 2010-10-23
    • 1970-01-01
    • 2010-09-25
    • 2018-06-27
    相关资源
    最近更新 更多