Skip to content

Commit e3be578

Browse files
authored
Update CONTRIBUTING.md
1 parent 7bf4eaf commit e3be578

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

CONTRIBUTING.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,22 @@ Follow either of the two links above to access the appropriate CLA and instructi
1717

1818
### Contributing code
1919

20-
If you have improvements to Tangent, send us your pull requests!
20+
#### Adding new derivatives
21+
22+
We still have a lot of derivatives we need to write! To add a new derivative for a primitive operation,
23+
24+
- [Read the docs on how to write derivatives in Tangent, and look at some examples](https://github.com/google/tangent/blob/7bf4eaffd646a5906aa15a852f117833d37fb09a/tangent/grads.py#L14-L33)!
25+
- Add your primitive op's reverse-mode derivative to grads.py (example reverse-mode derivative [for np.sin](https://github.com/google/tangent/blob/7bf4eaffd646a5906aa15a852f117833d37fb09a/tangent/grads.py#L230-L232), and for [tf.sin](https://github.com/google/tangent/blob/7bf4eaffd646a5906aa15a852f117833d37fb09a/tangent/tf_extensions.py#L183-L185)).
26+
- Add its forward-mode derivative to tangents.py (example forward-mode derivative for [np.sin](https://github.com/google/tangent/blob/7bf4eaffd646a5906aa15a852f117833d37fb09a/tangent/tangents.py#L144-L146), and for [tf.sin](https://github.com/google/tangent/blob/7bf4eaffd646a5906aa15a852f117833d37fb09a/tangent/tf_extensions.py#L344-L346))
27+
- Add a function using the primitive operation in functions.py. Our tests will pick up on it automatically ([example test function](https://github.com/google/tangent/blob/7bf4eaffd646a5906aa15a852f117833d37fb09a/tests/functions.py#L406-L407)).
28+
- Make sure the tests pass. The tests will be run automatically with Travis once you submit a PR, but it's good to do this locally, so you don't have to wait as long.
29+
```
30+
# Make sure you have pytest installed
31+
pip install pytest
32+
# Run this command from the root of the Tangent project
33+
py.test --short tests
34+
```
35+
36+
#### Adding other new functionality
37+
38+
Tangent is a work-in-progress, so there's a lot of upgrades and tweaks that would be useful. If you've already fixed a bug, or added an enhancement, open a PR, and the team will take a look at it, and help you polish it, conform to style guidelines etc., before we merge it. If you're thinking about embarking on a feature enhancement, open a GitHub issue to start a discussion, or [talk to us on gitter](https://gitter.im/google/tangent).

0 commit comments

Comments
 (0)