-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the inference example to an unittest #7874
Change the inference example to an unittest #7874
Conversation
460854e
to
20d3af6
Compare
d021c86
to
eca58a6
Compare
if args.nn_type == 'mlp': | ||
tensor_img = numpy.random.rand(1, 28, 28).astype("float32") | ||
else: | ||
tensor_img = numpy.random.rand(1, 1, 28, 28).astype("float32") |
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.
Why are the numpy array dimensions different for 'mlp' and 'conv_net' ?
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.
Because the input's dimension of conv_op
should be 4-D or 5-D, and the input's dimension of mul_op
will be flattened into 2-D. So, we can use line 169
to simplify the code.
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!
Maybe wait for @luotao1 and @sidgoyal78 to also have a look?
A separate question would be "are we going to merge this before #7690"?
…MakeLists.txt of inference unittest.
90a8150
to
6ac2e07
Compare
3c56151
to
f5d9336
Compare
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.
Thanks for the PR. I have one suggestion: for adding the inference example in the python side, can we create another folder?
I remember the test_recognize_digits.py
was modified significantly by someone few days back (and in that process the inference parts were simply deleted). So maybe just to avoid general conflict, we can do some code duplication in order to keep things independent?
fefe426
to
f5990b4
Compare
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
If doing this, there will be so many redundant codes. All the network will be write twice and train twice, because we need to use the training results.
It won't happen again, because I change the inference example to an unittest. If someone deletes the python codes again, the CI will fail. |
fix #7876