2016-10-04 1 views
1

Je débutez dans le tensorflow sur OSX et installé la version dure en suivant les lignes directrices pour une installation de pépin en utilisant:Erreur dans tf.contrib.learn Quickstart, aucun attribut nommé load_csv

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

Aperçu rapide:

OS: OS X El Capitan Version 10.11.6 (15G31)

Python: Python 2.7.12_1 installé avec brew install python

Tensor Débit: 0.11.0rc0 de import tensorflow as tf; print(tf.__version__)

je peux courir tensorflow en utilisant:

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

Alors tensorflow est installé et exécuté les commandes de base.

Mais quand je lance le code pour tf.contrib.learn Quickstart d'ici: https://www.tensorflow.org/versions/r0.11/tutorials/tflearn/index.html

Je reçois la question suivante:

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' 

Je ne peux pas comprendre ce qui a mal tourné que tout d'autre semble fonctionner correctement. Des idées ce qui ne va pas?

Répondre

2

Cette fonction a été désapprouvée: https://github.com/tensorflow/tensorflow/commit/2d4267507e312007a062a90df37997bca8019cfb

Et le tutoriel ne semble pas à jour. Je crois que vous pouvez simplement remplacer load_csv avec load_csv_with_header pour le faire fonctionner.

+0

Merci. J'ai remplacé load_csv par load_csv_with_headers et ajouté l'argument supplémentaire pour feature_dtype = np.float32. –

+0

@IsaacNoble C'est 'features_dtype'. À partir de [base.py] (https://github.com/tensorflow/tensorflow/blob/r0.11/tensorflow/contrib/learn/python/learn/datasets/base.py): 'load_csv_with_header (nom_fichier, type_type, caractéristiques_dtype , target_column = -1) ' –

1

La solution rapide pour les personnes voulant exécuter le tutoriel.

Remplacer

# 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) 

avec

# 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)