提交 c840119b 编写于 作者: Y Yangqing Jia

dropout serious bugfix. Seems to be working...

上级 e1af72e5
......@@ -97,9 +97,7 @@ __global__ void DropoutBackward(const int n, const Dtype* in_diff,
Dtype* out_diff) {
int index = threadIdx.x + blockIdx.x * blockDim.x;
if (index < n) {
if (mask[index] > threshold) {
out_diff[index] = in_diff[index] * scale;
}
out_diff[index] = in_diff[index] * scale * (mask[index] > threshold);
}
}
......
......@@ -23,9 +23,8 @@ message Datum {
}
message FillerParameter {
// The filler type. In default we will set it to Gaussian for easy
// debugging.
optional string type = 1 [default = 'gaussian'];
// The filler type.
optional string type = 1 [default = 'constant'];
optional float value = 2 [default = 0]; // the value in constant filler
optional float min = 3 [default = 0]; // the min value in uniform filler
optional float max = 4 [default = 1]; // the max value in uniform filler
......
......@@ -26,5 +26,4 @@ TEST_F(ProtoTest, TestSerialization) {
EXPECT_TRUE(true);
}
}
......@@ -19,6 +19,7 @@ using namespace caffe;
int main(int argc, char** argv) {
cudaSetDevice(0);
Caffe::set_mode(Caffe::GPU);
Caffe::set_phase(Caffe::TRAIN);
NetParameter net_param;
ReadProtoFromTextFile("data/lenet.prototxt",
......@@ -34,7 +35,7 @@ int main(int argc, char** argv) {
SolverParameter solver_param;
solver_param.set_base_lr(0.01);
solver_param.set_display(0);
solver_param.set_display(1);
solver_param.set_max_iter(6000);
solver_param.set_lr_policy("inv");
solver_param.set_gamma(0.0001);
......@@ -63,6 +64,8 @@ int main(int argc, char** argv) {
Net<float> caffe_traintest_net(traintest_net_param, bottom_vec);
caffe_traintest_net.CopyTrainedLayersFrom(trained_net_param);
Caffe::set_phase(Caffe::TEST);
// Test run
double train_accuracy = 0;
int batch_size = traintest_net_param.layers(0).layer().batchsize();
......
......@@ -19,6 +19,7 @@ using namespace caffe;
int main(int argc, char** argv) {
cudaSetDevice(0);
Caffe::set_mode(Caffe::GPU);
Caffe::set_phase(Caffe::TRAIN);
NetParameter net_param;
ReadProtoFromTextFile(argv[1],
......@@ -49,11 +50,11 @@ int main(int argc, char** argv) {
SolverParameter solver_param;
solver_param.set_base_lr(0.01);
solver_param.set_display(1);
solver_param.set_max_iter(2);
solver_param.set_max_iter(60000);
solver_param.set_lr_policy("fixed");
solver_param.set_momentum(0.9);
solver_param.set_weight_decay(0.0005);
solver_param.set_snapshot(1);
solver_param.set_snapshot(5000);
solver_param.set_snapshot_prefix("alexnet");
LOG(ERROR) << "Starting Optimization";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册