for loop to add layers with multiple choices is not working
See original GitHub issueHi,
I was looking for examples about how to add multiples layers using a for
loop and I got something similar to this code (line 85). Did you notice the for
loop is not working how it suppose to be? I mean, I want that depending on the choice
in range
add some layers with a different choice for each layer but instead, I’m getting yeah multiple layers but all of them with the same choice.
Here an example of the results I got after running minimize:
model = Sequential([
# first layer out of the loop:
layers.Conv2D(filters=256, kernel_size=(4, 4), activation='tanh', input_shape=(128, 128, 3)),
layers.MaxPool2D(pool_size=(2,2)),
layers.Dropout(0.7139834391535448),
# second layer in the loop after for _ in range(2):
layers.Conv2D(filters=128, kernel_size=(3, 3), activation='relu'), # << same filter and kernel
layers.MaxPool2D(pool_size=(2,2)),
layers.Dropout(0.48363463144260765), # << same dropout
# third layer in the loop
layers.Conv2D(filters=128, kernel_size=(3, 3), activation='relu'), # << same filter and kernel
layers.MaxPool2D(pool_size=(2,2)),
layers.Dropout(0.48363463144260765), # << same dropout
layers.Flatten(),
layers.Dense(256, activation='relu'),
layers.Dropout(0.7692559015213345),
layers.Dense(5, activation='sigmoid', name='predict')
What am I doing wrong? or shouldn’t I use a loop at all? Thanks!
Regards, David Molina
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to use a loop to add layers to the map that are not ...
Now I am trying to add an addAllLayers function, using a similar loop. Issue is, I don't really understand what the resetMap loop...
Read more >Loop to add groups and layers based on user's checkbox choice
Logic of adding/removing layers can then go something like this: At each #exec click loop through all the checkboxes (not just selected).
Read more >Loop animations - Google Web Designer Help
Loop the animation for multiple elements · Right-click the Events track (the first row of the timeline) where you want the animation to...
Read more >Video: Create and change SmartArt - Microsoft Support
These SmartArt features work similarly across your Office apps. Add SmartArt. Select Insert > SmartArt. On the left, select the type of layout...
Read more >Reusable Choices - Qualtrics
Multiple Choice Question · Matrix Table Question · Text Entry Question · Form Field Question ... CSV/TSV Upload Issues · Adding & Removing...
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
@virtualdvid The last thing you could try is running my code and try to figure out if that works. A simple git clone should do, as everything (including the data) is in the repository. Unfortunately i’m unable to test the code myself due to some trouble with my current GPU setup. I thought the loops were working, but i might as well have not noticed it to be faulty. The code had been written in quite the hurry… Sorry to not be able to help you any further.
Good luck!
@deKeijzer it works exactly the same, I just put it into a variable to get a “custom” name, you know hyperas named things in a confusing way.