-
Notifications
You must be signed in to change notification settings - Fork 9
Add accuracy func and test mnist accuracy #40
Add accuracy func and test mnist accuracy #40
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
src/example/mnist/test_mnist.cc
Outdated
Linear linear3(200, 10, "relu"); | ||
std::string filename1 = "/tmp/mnist_train.recordio"; | ||
std::string filename2 = "/tmp/mnist_test.recordio"; | ||
PADDLE_ENFORCE(is_file_exist(filename1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put is_file_exist
inside CreateRecordioFileReader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -110,6 +110,9 @@ class Linear { | |||
{{"X", {pre_bias}}, {"Y", {b_}}}, | |||
{{"Out", {pre_act}}}, | |||
add_op_attrs); | |||
if (act_.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also make Conv
support act_.empty()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for both conv and batchnorm
src/function.h
Outdated
reader->GetMutable<paddle::framework::ReaderHolder>()->ReadNext( | ||
&data_holder); | ||
} else { | ||
return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this return {}
hide the check PADDLE_ENFORCE(!data_holder.empty(), "Error reading file.");
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Revised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments addressed.
src/function.h
Outdated
reader->GetMutable<paddle::framework::ReaderHolder>()->ReadNext( | ||
&data_holder); | ||
} else { | ||
return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Revised.
@@ -110,6 +110,9 @@ class Linear { | |||
{{"X", {pre_bias}}, {"Y", {b_}}}, | |||
{{"Out", {pre_act}}}, | |||
add_op_attrs); | |||
if (act_.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for both conv and batchnorm
src/example/mnist/test_mnist.cc
Outdated
Linear linear3(200, 10, "relu"); | ||
std::string filename1 = "/tmp/mnist_train.recordio"; | ||
std::string filename2 = "/tmp/mnist_test.recordio"; | ||
PADDLE_ENFORCE(is_file_exist(filename1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
The accuracy is tested on the mnist test set.