Custom FeedForwardPolicy does not care for net_arch parameters
See original GitHub issueDescribe the bug I am trying to create my own Custom Policy network, however when I check the tensorboard logs and look under graphs I can see that it does not create the network as specified after my cnn extraction: net_arch=[64, dict(pi=[64, 64], vf=[64, 64])],
Code example
class CustomPolicy(FeedForwardPolicy):
def __init__(self, *args, **kwargs,):
super(CnnExtractor, self).__init__(*args, **kwargs,
cnn_extractor=custom_cnn,
act_fun=tf.nn.relu,
net_arch=[64, dict(pi=[64, 64],
vf=[64, 64])],
feature_extraction='cnn', )
def custom_cnn(scaled_images, **kwargs):
"""
:param scaled_images: (TensorFlow Tensor) Image input placeholder
:param kwargs: (dict) Extra keywords parameters for the convolutional layers of the CNN
:return: (TensorFlow Tensor) The CNN output layer
"""
activ = tf.nn.relu
layer_1 = activ(conv(scaled_images, 'c1', n_filters=18, filter_size=2, stride=1, **kwargs))
layer_2 = activ(conv(layer_1, 'c2', n_filters=64, filter_size=2, stride=1, **kwargs))
layer_3 = activ(conv(layer_2, 'c3', n_filters=64, filter_size=2, stride=1, **kwargs))
layer_3 = conv_to_fc(layer_3)
return activ(linear(layer_3, 'fc1', n_hidden=64))
I have attached the tensboard files here: logs.zip
System Info Describe the characteristic of your environment:
- Describe how the library was installed (pip, docker, source, …)
-
- PIP
- GPU models and configuration
-
- GTX 1070
- Python version
-
- 3.7
- Tensorflow version
- 1.15.0
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Custom Policy Network - Stable Baselines - Read the Docs
The net_arch parameter of FeedForwardPolicy allows to specify the amount and size of the hidden layers and how many of them are shared...
Read more >Understanding custom policies in stable-baselines3
What I can say after i went through all the library code. CnnPolicy is differ to MlpPolicy only in implemented default BaseFeatureExtraction ...
Read more >Define Custom Deep Learning Layer with Learnable Parameters
This example shows how to define a PReLU layer and use it in a convolutional neural network.
Read more >Adding Custom Actions - Juniper Networks
Values that are passed to the custom action script. These properties are not based on the events or flow themselves, but cover other...
Read more >Using Custom Tuning Parameters When Tuning a Neural ...
Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to redefine the policy completely for that, see https://stable-baselines.readthedocs.io/en/master/guide/custom_policy.html whereas SB3 supports that easily.
See https://stable-baselines3.readthedocs.io/en/master/guide/tensorboard.html#directly-accessing-the-summary-writer and https://github.com/DLR-RM/stable-baselines3/issues/286
Alright