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);
}
}
}
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
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",
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);
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();
int main(int argc, char** argv) {
cudaSetDevice(0);
Caffe::set_mode(Caffe::GPU);
+ Caffe::set_phase(Caffe::TRAIN);
NetParameter net_param;
ReadProtoFromTextFile(argv[1],
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";