INJUN CHOI
INJUN CHOI

Reputation: 13

How to restore in fully connected layer using tensorflow

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")

After save the graph from train.py, I want restore for prediction variable in test.py, but not working.

'tf.contrib.layers.fully_connected' does not have a name parameter. There is only scope parameter. How can I restore it?

Upvotes: 1

Views: 149

Answers (1)

nessuno
nessuno

Reputation: 27042

Get the name that tensorflow defined for you for the fully connected layer:

train.py

print(prediction.name)

it will be something like prediction/BiasAdd:0

use that name in test.py to correctly restore the variable

Upvotes: 2

Related Questions