'tensorflow.contrib'没有属性'constrained_optimization'

时间:2018-07-01 09:43:15

标签: python tensorflow github

tf.__version__=1.8.0

我通过pip安装了Tensorflow的CPU版本。 尝试运行github提供的examptlt进行constrained_optimization时,我得到了:

import tensorflow as tf
tfco = tf.contrib.constrained_optimization



Traceback (most recent call last):

  File "<ipython-input-1-9c9704a9d654>", line 1, in <module>
    runfile('D:/Anaconda3/envs/tf/Lib/site-packages/tensorflow/contrib/constrained_optimization/untitled1.py', wdir='D:/Anaconda3/envs/tf/Lib/site-packages/tensorflow/contrib/constrained_optimization')

  File "D:\Anaconda3\envs\tf\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
    execfile(filename, namespace)

  File "D:\Anaconda3\envs\tf\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/Anaconda3/envs/tf/Lib/site-packages/tensorflow/contrib/constrained_optimization/untitled1.py", line 12, in <module>
    tfco = tf.contrib.constrained_optimization

  File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 54, in __getattr__
    return getattr(module, item)

AttributeError: module 'tensorflow.contrib' has no attribute 'constrained_optimization'

我无法在tensorflow文件夹/ contrib /中找到constrain_optimiztion文件夹,就像github master中提供的那样。

2018/07/01  17:34    <DIR>          all_reduce
2018/07/01  17:34    <DIR>          android
2018/07/01  17:34    <DIR>          batching
2018/07/01  17:34    <DIR>          bayesflow
2018/07/01  17:34    <DIR>          boosted_trees
2018/07/01  17:34    <DIR>          cloud
2018/07/01  17:34    <DIR>          cluster_resolver
2018/07/01  17:34    <DIR>          coder
2018/07/01  17:34    <DIR>          compiler
2018/07/01  17:34    <DIR>          copy_graph
2018/07/01  17:34    <DIR>          crf
2018/07/01  17:34    <DIR>          cudnn_rnn
2018/07/01  17:34    <DIR>          data

虽然github大师提供了:

tensorflow/tensorflow/contrib/constrained_optimization/

我可以尝试GPU版本吗?还是从github构建tensorflow?还是只将文件夹复制到我的pip版本中?

0 个答案:

没有答案