【问题标题】:How to restore in fully connected layer using tensorflow如何使用 tensorflow 在全连接层中恢复
【发布时间】:2018-12-13 03:40:17
【问题描述】:

train.py:

prediction = tf.contrib.layers.fully_connected(outputs[:, -1, :], 
                                output_dim, activation_fn=None, scope="prediction")

test.py:

prediction = graph.get_tensor_by_name("prediction:0")

从 train.py 保存图表后,我想恢复 test.py 中的预测变量,但无法正常工作。

'tf.contrib.layers.fully_connected' 没有 name 参数。只有 scope 参数。如何恢复?

【问题讨论】:

    标签: python tensorflow machine-learning time-series


    【解决方案1】:

    获取 tensorflow 为您定义的全连接层的名称:

    train.py

    print(prediction.name)
    

    类似于prediction/BiasAdd:0

    在 test.py 中使用该名称来正确恢复变量

    【讨论】:

      猜你喜欢
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 2018-05-13
      • 2020-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      相关资源
      最近更新 更多