我在matlab中使用强化学习进行控制在actor的网络最后一层用的是tanhlayer,那么输出的范围应该在-1到1,但是输出的大小却不是
Show older comments
actorNet = [
featureInputLayer(numObs, Name="StateInLyr")
fullyConnectedLayer(64)
reluLayer
fullyConnectedLayer(32)
reluLayer
fullyConnectedLayer(numAct)
tanhLayer(Name="ActionOutLyr")
];
图片是actoer的输出,一共是6维,每个维度的输出都不在这个范围

Answers (1)
Krishna
on 6 Jun 2024
0 votes
Hi Guiyang,
If the output of a tanh layer in your network is not within the expected range of -1 to 1, consider the following points:
- Minor deviations from the expected range might be due to floating-point precision limits. These are typically negligible.
- Check if there's any scaling or modification applied after the tanh output that might alter its range.
- Ensure that the tanh layer is indeed the final layer in your network, with no additional operations post-tanh.
- Verify that the method used for logging or visualizing outputs is accurate and not introducing errors or not scaling the tanh output.
Also you can follow these troubleshooting Steps:
- Test the tanh function with known inputs to confirm its correct behavior.
- Double-check the network architecture for unintended layers or operations after the tanh.
These steps should help identify and resolve the issue with the tanh layer output.
Also please follow this documentation to ask question better and get quick answers,
Hope this helps.
Categories
Find more on Applications 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!