Repository navigation
docs: document tanh, leaky_relu, gelu, visualize and visualize_dot - #84
Merged
Merged
Conversation
Add the missing entries to the Tensor API reference, based on the current behaviour in leanpass/tensor.py. gelu is documented as the tanh approximation that the code uses. grad_check is not covered here because it is defined twice in tensor.py and its behaviour is tracked in Terminay#8. Refs Terminay#4
Owner
|
Looks good to me. Very nicely done and left out the appropriate part! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #4
Documents the missing methods in
docs/api-reference/tensor.md:tanh(),leaky_relu(negative_slope=0.01),gelu()(placed aftersigmoid())visualize(),visualize_dot()(placed aftermatmul())gelu()is described as the tanh approximation, which is what the code computes (not the exact erf form).visualize()returns a text listing of nodes/edges;visualize_dot()returns a Graphviz DOT string. Neither writes a file or needs Graphviz.Verification: installed the package in a separate venv and ran each method, checking forward values and gradients (e.g. tanh, leaky_relu, gelu on small inputs with
backward()), and printed the output of both visualize methods to confirm the descriptions. The existing test suite passes (22 tests). Line endings (CRLF) are preserved.Left out:
grad_check(). It is defined twice inleanpass/tensor.pyand the behaviour is the subject of #8, so I did not document it here. That is why this usesRefs #4instead of closing the issue. Thesum()/mean()text is untouched (#5).