Add scalar inputs to the actor network
Show older comments
I have a CNN based PPO actor critic, and it is working fine, but now I am trying to add three scalar values to the actor network. The observation originally was [12 12 4] as we have a 12*12 environment and 4-channel image:
% Define observation specifications.
obsSize = [12 12 4];
oinfo = rlNumericSpec(obsSize);
oinfo.Name = "observations";

I am trying to add four scalar inputs to the actor network, I used the following actor network, but when I am use the following line of code in training, I have a trouble:
actor(idx) = rlContinuousGaussianActor(actorNetwork,oinfo,ainfo);
Error using rl.internal.validate.mapFunctionObservationInput
Number of input layers for deep neural network must equal to number of observation specifications.
Error in rlContinuousGaussianActor (line 95)
modelInputMap = rl.internal.validate.mapFunctionObservationInput(model,observationInfo,nameValueArgs.ObservationInputNames);
I am not sure how I can change the observation size that I can able to add 3 scalar values. Here are some information about the workspace:
% actorNetwork =
% LayerGraph with properties:
% Layers: [21×1 nnet.cnn.layer.Layer]
% Connections: [20×2 table]
% InputNames: {'featureinput_3' 'featureinput_1' 'featureinput_2' 'imageinput'}
% OutputNames: {1×0 cell}
%
% oinfo =
% rlNumericSpec with properties:
% LowerLimit: -Inf
% UpperLimit: Inf
% Name: "observations"
% Description: [0×0 string]
% Dimension: [12 12 4]
% DataType: "double"
%
% ainfo =
% rlNumericSpec with properties:
% LowerLimit: -1
% UpperLimit: 1
% Name: "actions"
% Description: [0×0 string]
% Dimension: [1 2]
% DataType: "double"
1 Comment
ali farid
on 17 Jan 2024
Accepted Answer
More Answers (0)
Categories
Find more on Training and Simulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!