Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAB committed Dec 13, 2019
1 parent 642c065 commit 764872a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/dropout_layer_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ void forward_dropout_layer_gpu(dropout_layer l, network_state state)
const int x_block = rand_int(0, l.w - block_width - 1);
const int y_block = rand_int(0, l.h - block_height - 1);
for (y = y_block; y < (y_block + block_height); y++) {
for (x = x_block; x < (x_block + block_width); x++) {
const int index = x + y*l.w + pre_index;
l.rand[index] = 1;
}
memset(&l.rand[x_block + y*l.w + pre_index], 1, block_width * sizeof(float));
//for (x = x_block; x < (x_block + block_width); x++) {
// const int index = x + y*l.w + pre_index;
// l.rand[index] = 1;
//}
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ dropout_layer parse_dropout(list *options, size_params params)
int dropblock = option_find_int_quiet(options, "dropblock", 0);
float dropblock_size_rel = option_find_float_quiet(options, "dropblock_size_rel", 0);
int dropblock_size_abs = option_find_float_quiet(options, "dropblock_size_abs", 0);
if (dropblock_size_abs > params.w || dropblock_size_abs > params.h) {
printf(" [dropout] - dropblock_size_abs = %d that is bigger than layer size %d x %d \n", dropblock_size_abs, params.w, params.h);
dropblock_size_abs = min_val_cmp(params.w, params.h);
}
if (!dropblock_size_rel && !dropblock_size_abs) {
printf(" [dropout] - None of the parameters (dropblock_size_rel or dropblock_size_abs) are set, will be used: dropblock_size_abs = 7 \n");
dropblock_size_abs = 7;
Expand Down Expand Up @@ -898,10 +902,11 @@ learning_rate_policy get_policy(char *s)

void parse_net_options(list *options, network *net)
{
net->max_batches = option_find_int(options, "max_batches", 0);
net->batch = option_find_int(options, "batch",1);
net->learning_rate = option_find_float(options, "learning_rate", .001);
net->learning_rate_min = option_find_float_quiet(options, "learning_rate_min", .00001);
net->batches_per_cycle = option_find_int_quiet(options, "sgdr_cycle", 1000);
net->batches_per_cycle = option_find_int_quiet(options, "sgdr_cycle", net->max_batches);
net->batches_cycle_mult = option_find_int_quiet(options, "sgdr_mult", 2);
net->momentum = option_find_float(options, "momentum", .9);
net->decay = option_find_float(options, "decay", .0001);
Expand Down Expand Up @@ -1013,7 +1018,7 @@ void parse_net_options(list *options, network *net)
} else if (net->policy == POLY || net->policy == RANDOM){
//net->power = option_find_float(options, "power", 1);
}
net->max_batches = option_find_int(options, "max_batches", 0);

}

int is_network(section *s)
Expand Down

0 comments on commit 764872a

Please sign in to comment.