o_yeah
o_yeah

Reputation: 788

How to connect output layers to the input layer of another neural network?

The Actor-network has 5 input neurons representing the state values and will produce one output value held by one output neuron.

The Q Network has 6 input neurons: 5 representing the state values and 1 representing the output of Actor-network.

I'll do gradient descent to train the Actor-network seperately, holding Q network's weights as constant.

My question is: How should I structure to plug the output layer of Actor-Network into the input layer of the Q network, with TensorFlow 2.x?

Neural network structure

Upvotes: 0

Views: 1296

Answers (1)

Frederik Bode
Frederik Bode

Reputation: 2744

You can just use the ŧf.keras.Model API:

actor_model = tf.keras.Model(inputs=...,outputs=...)
Q_model = tf.keras.Model(inputs=actor_model.outputs, outputs=...)

Upvotes: 3

Related Questions