2016-10-04 45 views
1

我入門tensorflow在OSX和安裝設備時遵循一個點安裝指南使用歷時版本:錯誤,沒有屬性命名load_csv

echo $TF_BINARY_URL 
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py2-none-any.whl 

快速概述:

OS:OS X埃爾卡皮坦版本10.11.6(15G31)

的Python:Python的2.7.12_1安裝有brew install python

張量流量:0.11.0rc0從import tensorflow as tf; print(tf.__version__)

我可以使用運行TensorFlow:

python 
>>> import tensorflow as tf 
>>> hello = tf.constant('Hello, TensorFlow!') 
>>> sess = tf.Session() 
>>> print(sess.run(hello)) 
>>> Hello, TensorFlow! 

所以安裝TensorFlow和運行的基本命令。

但是當我運行從這裏tf.contrib.learn快速啓動代碼: https://www.tensorflow.org/versions/r0.11/tutorials/tflearn/index.html

我得到了以下問題:

Traceback (most recent call last): 
    File "tf_learn_quickstart.py", line 13, in <module> 
    training_set = tf.contrib.learn.datasets.base.load_csv(filename=IRIS_TRAINING, 
AttributeError: 'module' object has no attribute 'load_csv' 

我無法弄清楚什麼地方出了錯應有盡有其他似乎工作正常。任何想法有什麼不對?

回答

2

此功能已棄用:https://github.com/tensorflow/tensorflow/commit/2d4267507e312007a062a90df37997bca8019cfb

而且似乎教程不是最新的。我相信你可以簡單地用load_csv_with_header替換load_csv來使它工作。

+0

謝謝。我用load_csv_with_headers替換了load_csv,併爲feature_dtype = np.float32添加了額外的參數。 –

+0

@IsaacNoble它是'features_dtype'。從[base.py](https://github.com/tensorflow/tensorflow/blob/r0.11/tensorflow/contrib/learn/python/learn/datasets/base.py):'load_csv_with_header(filename,target_dtype,features_dtype ,target_column = -1)' –

1

快速修復這裏的人希望運行教程。

更換

# Load datasets. 
training_set = tf.contrib.learn.datasets.base.load_csv(filename=IRIS_TRAINING, 
                 target_dtype=np.int) 
test_set = tf.contrib.learn.datasets.base.load_csv(filename=IRIS_TEST, 
                target_dtype=np.int) 

# Load datasets. 
training_set = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TRAINING, 
                    target_dtype=np.int, 
                    features_dtype=np.float32, 
                    target_column=-1) 
test_set  = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TEST, 
                    target_dtype=np.int, 
                    features_dtype=np.float32, 
                    target_column=-1) 
相關問題