Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions adv_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def weights_init(m):
- BatchNorm layers: Weights from N(1.0, 0.02), biases=0
"""
classname = m.__class__.__name__
# Check if the layer is a convolutional layer
# The find() method returns -1 if 'Conv' is not found in the class name
if classname.find('Conv') != -1:
nn.init.normal_(m.weight.data, 0.0, 0.02)
elif classname.find('BatchNorm') != -1:
Expand Down