got an unexpected keyword argument

来源:4-11 可视化利器TensorBoard(下)

覆海神龙

2018-03-02

(tensorflow) macbook:tensorflow zhutx$ python tensorboard.py
Traceback (most recent call last):
  File "tensorboard.py", line 8, in <module>
    W = tf.Variable(2.0, dtype=tf.float32, name="Weight") # 权重
TypeError: __init__() got an unexpected keyword argument 'dtype'
(tensorflow) macbook:tensorflow zhutx$ python -V
Python 2.7.10
(tensorflow) macbook:tensorflow zhutx$ python -c "import numpy; print numpy.version.version"
1.14.1

这章节运行出错,跟版本有关吗?

写回答

1回答

Oscar

2018-03-02

我运行 python tensorboard.py 没有问题啊。

TensorFlow 1.4.0 和 Python 2.7

以及

TensorFlow 1.5.0 和 Python 3.5

都没问题诶。


你的 TensorFlow 是什么版本?

你可以在 Python 解释器里输入下面的命令来显示 TensorFlow 版本:

>>> import tensorflow as tf
/home/exe/anaconda3/envs/universe/lib/python3.5/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
>>> tf.__version__
'1.5.0'




0
0

基于Python玩转人工智能最火框架 TensorFlow应用实践

机器学习入门,打牢TensorFlow框架应用是关键!

2214 学习 · 688 问题

查看课程