How to deploy Trained Reinforcement Learning Policy with a NN having two input layer?

1 view (last 30 days)
I am having a trained DQN agent, that I want to use in a C++ project. By definition this agent has a deep neural network with two input layers (observation first, action second).
In this Article about deploying RL policies it is stated that "Generating code for deep neural network policies supports networks with only a single input layer".
This is why I cannot us the generatePolicyFunction on my trained DQN agent.
However is there another way to deploy an DQN agent?
_____________________________________________________________________________________
PS: Even your own example with a predefined DQN agent (two input layers) described here is not working. The following commands
load('MATLABCartpoleDQN.mat','agent')
generatePolicyFunction(agent,'FunctionName',"computeAction")
still give me the output: "Code Generation for rlLayerRepresentation objects supports only networks with a single input layer and a single output layer"
Thanks for your answers.

Accepted Answer

Anh Tran
Anh Tran on 21 Mar 2020
Edited: Anh Tran on 21 Mar 2020
As of R2020a, you can create a DQN agent with Q(s) value function. Q(s) takes observation as input and output Q(s,a) for each possible discrete action. If you have single observation channel, you can generate the policy function and deploy since the Q(s) network now has a single input, observation.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!