Tensorflow-'str'对象没有属性'op'-Adam Optimizer-var_list

时间:2018-11-23 18:01:26

标签: python tensorflow

我正在尝试将Adam与var_list一起使用,但无法正常工作。

 def get_name_trainable_variables(self):
    var_names = []
    for var in tf.trainable_variables():

        var_names.append(var.name)

    return var_names
/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/optimizer.py in _get_processor(v)
    200     # True if and only if `v` was initialized eagerly.
    201     return _DenseResourceVariableProcessor(v)
--> 202   if v.op.type == "VarHandleOp":
    203     return _DenseResourceVariableProcessor(v)
    204   if isinstance(v, variables.Variable):

AttributeError: 'str' object has no attribute 'op'

0 个答案:

没有答案