2016-11-15 2 views
0

ソースからテンソルフローを構築しました。私はロードするイメージを選択するためにデータを読み込む際にtf.condを使用しています。それは次のようになります。Tensorflow condはソースと異なる動作をします

reader = tf.TFRecordReader() 
_, serialized_example = reader.read(filename_queue) 
features = tf.parse_single_example(
    serialized_example, 
    features={ 
     'label': tf.FixedLenFeature([], tf.float32), 
     'right': tf.VarLenFeature(tf.string), 
     'center': tf.VarLenFeature(tf.string), 
     'left': tf.VarLenFeature(tf.string) 
    }) 
label = features['label'] 
image, label = tf.cond(rand < -0.7, lambda: (features['right'],label + 0.08), lambda: (features['center'], label)) 
image, label = tf.cond(rand > 0.7, lambda: (features['left'], label - 0.08), lambda: (image,label)) 

これは、しかし、私は次のエラーを取得するピップにインストールされている他のマシン0.11rc2(とRC1)を持つ上、バージョン(0.11rc1周り)ソースからビルドしてperfeclty正常に動作します:

File "./example_reader.py", line 29, in read_and_decode_single_example 
    image, label = tf.cond(rand < -0.7, lambda: (features['right'],label + 0.08), lambda: (features['center'], label)) 
    File "./local/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1710, in cond 
    orig_res, res_t = context_t.BuildCondBranch(fn1) 
    File "./local/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1626, in BuildCondBranch 
    elif v.name not in self._values: 
AttributeError: 'SparseTensor' object has no attribute 'name' 

私はアイデアを持っていません。ここに問題があります...あなたが私を助けてくれることを願っています。

答えて

0

SparseTensorのAPIはおそらく2つのバージョンの間で変更されました。 1.0バージョンを試して、問題がまだ存在するかどうか確認してください。

+0

はい、ソースからのビルドには新しいAPI機能があるようです。 0.12への更新が修正されました。すぐに1.0に切り替える必要があるかどうかわかりません。それは完璧に動作するのだろうか? –

+0

1.0リリースで提供されているアップグレードスクリプトを使用してコードを更新すると、完璧に動作するはずです。 –

関連する問題