-
Notifications
You must be signed in to change notification settings - Fork 137
Move Dense and Dropout layers to separate files #541
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
I just noticed (too late) that this PR also includes the precondition described here. Is this a problem? |
@rickwierenga, it's ideal if we keep the splitting of core.swift into separate files and this precondition as separate PRs |
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.
No extra spaces at the end of files.
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.
I think this LGTM, and can go in if there are no other concerns & it passes CI.
/// - Precondition: probability must be a value between 0 and 1 (inclusive). | ||
public init(probability: Double) { | ||
precondition(0...1 ~= probability, | ||
"Probability must be a value between 0 and 1 (inclusive) but is \(probability)") |
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.
FWIW, although it's generally better to have one logical change per PR, given that this is just one statement, I think it's probably okay to leave in.
Note: this change would break users who relied upon probability outside the range acting as if it's clamped to the range. I think this is okay, however, as this likely indicates a bug. That said, if we wanted to, we could provide a convenience initializer that would do the clamping to 0...1 and then delegate to this initializer. (This could be done in a follow-on PR.)
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.
FWIW, although it's generally better to have one logical change per PR, given that this is just one statement, I think it's probably okay to leave in.
You are absolutely right. I forgot to exclude it in the commit--will look more closely in the future.
Note: this change would break users who relied upon probability outside the range acting as if it's clamped to the range. I think this is okay, however, as this likely indicates a bug. That said, if we wanted to, we could provide a convenience initializer that would do the clamping to 0...1 and then delegate to this initializer. (This could be done in a follow-on PR.)
The convenience initializer ia a great idea. I think it should show some kind of message though indicating the input value will be clamped. Should this be a permanent or temporary initializer (with deprecation warning)?
Just fixed the ordering issue. I will leave the changes in Dropout.swift for the next PR. |
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 @rickwierenga!
For details see: https://groups.google.com/a/tensorflow.org/forum/m/#!topic/swift/-I-P8wjhsTg