-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Allow the python layer have attribute "phase" #3995
Conversation
Looks fine to me. Would you be able to add a test that demonstrates reading out the phase with TRAIN/TEST values as well? |
related to issue #3506 -- thanks for implementing this PR! |
Looks great to me. Can you squash the commits? @longjon , @shelhamer does this look good to you? |
pass | ||
|
||
def reshape(self, bootom, top): | ||
top[0].reshape(1) |
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.
Scalars should be 0d; use top[0].reshape()
.
I never really got much into phase myself, but this is a clear improvement for the completeness of Python layers, so it seems worthwhile. However, there are a few style issues, as noted. I'd be happy to merge once these are fixed (and squashed into the existing two commits). |
@longjon Thanks for review and I've fixed it. I'm glad this pr is helpful. |
Looks very clean now, thanks! |
Allow the python layer have attribute "phase"
I noticed that the python layer cannot tell whether the phase is TRAIN or TEST. This change may bring convenience in some cases. e.g. to me.