【问题标题】:Anaconda & Tensorflow & Skflow: dnn() got an unexpected keyword argument 'keep_prob'Anaconda & Tensorflow & Skflow:dnn() 得到了一个意外的关键字参数“keep_prob”
【发布时间】:2016-06-30 10:07:07
【问题描述】:

在 Anaconda 2.7 中运行此示例时:

import tensorflow.contrib.learn as skflow
def DNN_model(X, y):
    """This is DNN with 50, 20, 10 hidden layers, and dropout of 0.5 probability."""
    layers = skflow.ops.dnn(X, [50, 30, 10], keep_prob=0.5)
    return skflow.models.logistic_regression(layers, y)
clf = skflow.TensorFlowEstimator(model_fn=DNN_model, n_classes=3)

它转储了以下问题:

dnn() 得到了一个意外的关键字参数 'keep_prob'

Anaconda 中的 Tensorflow 是使用以下工具安装的:

conda install -c jjhelmus tensorflow=0.9.0

知道失败的原因吗?

【问题讨论】:

    标签: python tensorflow anaconda


    【解决方案1】:

    根据repository 看来这个版本已经贬值了:

    learn.ops.dnn is deprecated,please use contrib.layers.dnn.

    但是,应该传递不同的参数:

    def dnn(tensor_in, hidden_units, activation=nn.relu, dropout=None):
      """Creates fully connected deep neural network subgraph.
      This is deprecated. Please use contrib.layers.dnn instead.
      Args:
        tensor_in: tensor or placeholder for input features.
        hidden_units: list of counts of hidden units in each layer.
        activation: activation function between layers. Can be None.
        dropout: if not None, will add a dropout layer with given probability.
      Returns:
        A tensor which would be a deep neural network.
      """
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-31
      • 1970-01-01
      • 2016-09-17
      • 2015-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      相关资源
      最近更新 更多