Skip to content
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

Add algorithmic optimizer to convert Log(Softmax(x)) to LogSoftmax(x) #25455

Merged
merged 1 commit into from Mar 7, 2019

Conversation

lgeiger
Copy link
Contributor

@lgeiger lgeiger commented Feb 2, 2019

This PR adds an algorithmic optimizer which converts Log(Softmax(x)) to LogSoftmax(x). LogSoftmax is numerically more stable and may be a bit faster in some cases.

This could be expanded in the future to also optimize log(softmax(x) * y) = logsoftmax(x) + log(y) and log(softmax(x) / y) = logsoftmax(x) - log(y).

@rthadur rthadur added awaiting review Pull request awaiting review size:M CL Change Size: Medium labels Feb 2, 2019
@rthadur rthadur added this to Assigned Reviewer in PR Queue via automation Feb 2, 2019
@rthadur rthadur self-assigned this Feb 2, 2019
@rthadur rthadur requested a review from sb2nov February 2, 2019 17:57
@rthadur rthadur added awaiting review Pull request awaiting review and removed awaiting review Pull request awaiting review labels Feb 2, 2019
@sb2nov sb2nov requested review from rmlarsen and removed request for sb2nov February 3, 2019 07:15
@Harshini-Gadige
Copy link

@rmlarsen Could you PTAL and approve or suggest changes(if required).

This PR adds an algorithmic optimizer which converts `Log(Softmax(x))` to `LogSoftmax(x)`. [`LogSoftmax`](https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/log-softmax) is numerically more stable and may be a bit faster in some cases.

This could be expanded in the future to also optimize `log(softmax(x) * y) = logsoftmax(x) + log(y)` and `log(softmax(x) / y) = logsoftmax(x) - log(y)`.
@lgeiger
Copy link
Contributor Author

lgeiger commented Feb 28, 2019

Rebased since #25300 introduced some merge conflicts.

@lgeiger
Copy link
Contributor Author

lgeiger commented Mar 5, 2019

@hgadig Any updates on this?

@Harshini-Gadige
Copy link

@hgadig Any updates on this?

Waiting for the review. Also, this is assigned to rthadur and he will be taking care of this PR(fyi). Thanks !

@rthadur rthadur requested review from ezhulenev and removed request for rmlarsen March 6, 2019 01:09
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Mar 6, 2019
@ezhulenev
Copy link
Member

Thanks! Sorry for long review cycle.

@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Mar 6, 2019
@rthadur rthadur added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 6, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 6, 2019
joshrose pushed a commit to joshrose/tensorflow that referenced this pull request Mar 7, 2019
@tensorflow-copybara tensorflow-copybara merged commit 597f02c into tensorflow:master Mar 7, 2019
PR Queue automation moved this from Approved by Reviewer to Merged Mar 7, 2019
@lgeiger lgeiger deleted the optimize_logsoftmax branch March 7, 2019 01:08
@lgeiger
Copy link
Contributor Author

lgeiger commented Mar 7, 2019

Thanks! Sorry for long review cycle.

Thanks @ezhulenev, you've been really helpful with getting my fixes merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes ready to pull PR ready for merge process size:M CL Change Size: Medium
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

8 participants