Skip to content

Commit

Permalink
adding dropout to input
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedbesbes committed Oct 22, 2019
1 parent 79706a2 commit 88f7c30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def __init__(self, args, number_of_classes):

# define conv layers

self.dropout_input = nn.Dropout2d(args.dropout_input)

self.conv1 = nn.Sequential(nn.Conv1d(args.number_of_characters + len(args.extra_characters),
256,
kernel_size=7,
Expand Down Expand Up @@ -90,7 +92,7 @@ def _get_conv_output(self, shape):
# forward

def forward(self, x):
x = nn.Dropout2d(0.1)(x)
x = self.dropout_input(x)
x = x.transpose(1, 2)
x = self.conv1(x)
x = self.conv2(x)
Expand Down
1 change: 1 addition & 0 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ def run(args, both_cases=False):
parser.add_argument('--number_of_characters', type=int, default=69)
parser.add_argument('--extra_characters', type=str, default='')
parser.add_argument('--max_length', type=int, default=150)
parser.add_argument('--dropout_input', type=int, default=0.1)
parser.add_argument('--epochs', type=int, default=10)
parser.add_argument('--batch_size', type=int, default=128)
parser.add_argument('--optimizer', type=str,
Expand Down

0 comments on commit 88f7c30

Please sign in to comment.