如何在tesorflow中使用具有不同学习率的DNNRegressor?

时间:2016-10-07 03:33:37

标签: python machine-learning tensorflow deep-learning

我正在尝试使用此代码,但我有错误可以帮助我修复它吗?

感谢您的评论。

代码

learning_rate = tf.placeholder(tf.float32, shape=[])
regressor = tf.contrib.learn.DNNRegressor( feature_columns=None, optimizer=tf.train.GradientDescentOptimizer( learning_rate=learning_rate ),
                                           hidden_units= [10, 10, 10], activation_fn=tf.nn.sigmoid, model_dir="/home/edwin/workspace/tensorFlowPy/eval")

错误

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 330, in apply_op
    g = ops._get_graph_from_inputs(_Flatten(keywords.values()))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3821, in _get_graph_from_inputs
    _assert_same_graph(original_graph_element, graph_element)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3766, in _assert_same_graph
    "%s must be from the same graph as %s." % (item, original_item))
ValueError: Tensor("Placeholder:0", shape=(), dtype=float32) must be from the same graph as Tensor("dnn/hiddenlayer_0/weights/part_0:0", shape=(1, 10), dtype=float32_ref).

0 个答案:

没有答案