Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Move Dense and Dropout layers to separate files #541

Merged
merged 3 commits into from
Nov 7, 2019
Merged

Move Dense and Dropout layers to separate files #541

merged 3 commits into from
Nov 7, 2019

Conversation

rickwierenga
Copy link
Contributor

@googlebot
Copy link

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 @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@rickwierenga
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@rickwierenga
Copy link
Contributor Author

I just noticed (too late) that this PR also includes the precondition described here. Is this a problem?

@Shashi456
Copy link
Contributor

@rickwierenga, it's ideal if we keep the splitting of core.swift into separate files and this precondition as separate PRs

Copy link
Contributor

@Shashi456 Shashi456 left a 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.

Copy link
Contributor

@saeta saeta left a 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)")
Copy link
Contributor

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.)

Copy link
Contributor Author

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)?

@rickwierenga
Copy link
Contributor Author

Just fixed the ordering issue. I will leave the changes in Dropout.swift for the next PR.

Copy link
Member

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rickwierenga!

@dan-zheng dan-zheng merged commit 00f0398 into tensorflow:master Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants