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 LogSoftmax and LogSigmoid support #4921

Closed
wants to merge 6 commits into from
Closed

Add LogSoftmax and LogSigmoid support #4921

wants to merge 6 commits into from

Conversation

lrw04
Copy link
Contributor

@lrw04 lrw04 commented Aug 7, 2023

The patch adds LogSoftmax and LogSigmoid layers to ncnn and respective passes to pnnx.

@tencent-adm
Copy link
Member

tencent-adm commented Aug 7, 2023

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2023

Codecov Report

Merging #4921 (51ccd56) into master (0a8cf31) will increase coverage by 0.00%.
Report is 1 commits behind head on master.
The diff coverage is 95.53%.

@@           Coverage Diff            @@
##           master    #4921    +/-   ##
========================================
  Coverage   94.91%   94.91%            
========================================
  Files         776      778     +2     
  Lines      226096   226275   +179     
========================================
+ Hits       214589   214760   +171     
- Misses      11507    11515     +8     
Files Changed Coverage Δ
src/layer/logsoftmax.cpp 95.00% <95.00%> (ø)
src/layer/logsigmoid.cpp 100.00% <100.00%> (ø)

@lrw04
Copy link
Contributor Author

lrw04 commented Aug 7, 2023

Wait, is it better to rewrite logsigmoid/logsoftmax nodes into a log node and a sigmoid/softmax node in pnnx's pass_ncnn? This helps removing duplicate code but achieving higher numerical stability is impossible with this solution.

@nihui
Copy link
Member

nihui commented Aug 8, 2023

Wait, is it better to rewrite logsigmoid/logsoftmax nodes into a log node and a sigmoid/softmax node in pnnx's pass_ncnn? This helps removing duplicate code but achieving higher numerical stability is impossible with this solution.

For code reuse, additional parameters can be added to the existing sigmoid/softmax
In this way, there is no need to add additional layer types

@lrw04
Copy link
Contributor Author

lrw04 commented Aug 8, 2023

Is it better to rewrite logxxx nodes into a log node + a xxx node? I will submit another PR soon.

@lrw04 lrw04 closed this Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants