Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
420 commits
Select commit Hold shift + click to select a range
0839fa5
Update CODEOWNERS
Jan 31, 2020
227522b
Merge pull request #199 from ematejska/update_rfc_template_example
Feb 3, 2020
57e8fcb
Merge pull request #195 from aaudiber/rfc-data-service
Feb 3, 2020
55ed96b
Mark long term plan as optional, minor changes
annarev Feb 4, 2020
8532aba
RFC: TFX Generic Trainer
1025KB Feb 5, 2020
afdba42
Update 20200117-tfx-generic-trainer.md
1025KB Feb 5, 2020
67c6bcb
Update 20200117-tfx-generic-trainer.md
1025KB Feb 5, 2020
b269f13
Update 20191106-tf2-tpu-savedmodel.md
lzr-official Feb 5, 2020
f0999ed
Update 20191106-tf2-tpu-savedmodel.md
lzr-official Feb 5, 2020
e4865fd
Update 20200117-tfx-generic-trainer.md
1025KB Feb 5, 2020
26cafee
Merge pull request #1 from tensorflow/master
qlzh727 Feb 5, 2020
15fab62
Merge pull request #171 from lzr-google/master
Feb 5, 2020
7af3f0b
Initial commit for RFC standalone Keras repository
qlzh727 Feb 6, 2020
0145eea
Update wording and nits.
qlzh727 Feb 6, 2020
0405d80
Update 20200205-standalone-keras-repository.md
fchollet Feb 6, 2020
7064794
Merge pull request #2 from fchollet/patch-1
qlzh727 Feb 6, 2020
3cce978
Update the RFC nubmer
qlzh727 Feb 6, 2020
c43366e
Update 20200117-tfx-generic-trainer.md
1025KB Feb 6, 2020
0e7981a
Update 20200117-tfx-generic-trainer.md
1025KB Feb 7, 2020
3f0dc92
Update rfcs/20200205-standalone-keras-repository.md
qlzh727 Feb 10, 2020
0109f0f
Update rfcs/20200205-standalone-keras-repository.md
qlzh727 Feb 10, 2020
b654b44
Update tf to Keras usage with more details.
qlzh727 Feb 10, 2020
7c57540
Change to use the list view for comparison.
qlzh727 Feb 10, 2020
86d2c37
Update the section for PIP package dependency.
qlzh727 Feb 10, 2020
1504e52
Update the preferred PIP package version.
qlzh727 Feb 10, 2020
f4af07b
Update more details about the Github migration.
qlzh727 Feb 10, 2020
41396e8
Update status to accepted.
Feb 11, 2020
bc6bce3
Merge pull request #193 from frankchn/rfc-snapshot
Feb 11, 2020
0395440
Clone draft template for new tf-types RFC.
Feb 11, 2020
4e58ec3
Initial commit.
Feb 11, 2020
4553626
Capitalization
Feb 11, 2020
6c8eb85
Update rfcs/20191127-pip-structure.md
annarev Feb 11, 2020
001efcc
Update 20200211-tf-types.md
Feb 11, 2020
71a5164
Update 20200211-tf-types.md
Feb 11, 2020
0842a2f
Update 20200211-tf-types.md
Feb 11, 2020
e4fd7fa
Update 20200211-tf-types.md
Feb 11, 2020
4666892
Update 20200211-tf-types.md
Feb 11, 2020
de72ac5
Update 20200211-tf-types.md
Feb 11, 2020
e9720c1
Update 20200211-tf-types.md
Feb 12, 2020
d436dc6
Update 20200117-tfx-generic-trainer.md
1025KB Feb 13, 2020
d066269
Merge pull request #201 from 1025KB/patch-1
theadactyl Feb 14, 2020
e3224da
Update 20200211-tf-types.md
Feb 18, 2020
6872453
Update wording wrt to pure python project.
qlzh727 Feb 18, 2020
7144521
Update the sectoin for TF to keras dependency.
qlzh727 Feb 18, 2020
53680e5
Update 20200211-tf-types.md
Feb 19, 2020
7b21bf7
Update 20200211-tf-types.md
Feb 19, 2020
c951112
Update 20200211-tf-types.md
Feb 19, 2020
3cd6062
Update 20200117-tfx-combining-model-validator-with-evaluator.md
genehwung Feb 19, 2020
aae458f
Update 20200211-tf-types.md
Feb 20, 2020
f923705
Update 20200211-tf-types.md
Feb 20, 2020
dc924a7
Update PR number.
Feb 20, 2020
5d4ce1d
Add `TensorLike` to core types.
Feb 20, 2020
fb3e2f2
Clarify note about static checkers.
Feb 20, 2020
c42f292
Add note about ABC performance concerns
Feb 21, 2020
198a1d0
Clarify semantics of `Optional`
Feb 21, 2020
5bf02fb
Add details and example for `Optional`
Feb 21, 2020
2f4d14d
Fix typo.
Feb 21, 2020
52d5617
Update 20200211-tf-types.md
Feb 21, 2020
591cdec
Finalize design reviews for Keras categorical inputs.
tanzhenyu Feb 23, 2020
ecbc169
Address the comment from @apassos
qlzh727 Feb 25, 2020
ce8a20f
Update the states for python change history.
qlzh727 Feb 25, 2020
9123f7f
Updating the section for CI and presubmit.
qlzh727 Feb 25, 2020
11f3828
Update style and fix typo.
qlzh727 Feb 25, 2020
5de7dfe
Adding a section for Alternative considered.
qlzh727 Feb 25, 2020
7d1c748
Update @angersson to @angerson (#210)
angerson Feb 26, 2020
132f542
Fix typo for LasyLoader
qlzh727 Feb 26, 2020
1b0a94d
Update 20191016-dlpack-support.md
VoVAllen Feb 27, 2020
64145ba
Merge pull request #2 from VoVAllen/patch-1
EvenOldridge Feb 28, 2020
5100148
Update 20200117-tfx-combining-model-validator-with-evaluator.md
genehwung Feb 28, 2020
6c06a30
Merge pull request #200 from genehwung/master
Feb 29, 2020
0650b34
Update 20191212-keras-categorical-inputs.md
tanzhenyu Mar 2, 2020
53d92bd
Update 20191016-dlpack-support.md
EvenOldridge Mar 3, 2020
819da0d
Update 20191016-dlpack-support.md
VoVAllen Mar 4, 2020
d27dcb7
Add discussion topic
Mar 4, 2020
3cb07db
Update the RFC wrt to the design meeting outcome.
qlzh727 Mar 4, 2020
1343f17
Update the RFC status to 'Accepted'
qlzh727 Mar 4, 2020
975e96f
Merge pull request #3 from VoVAllen/patch-2
EvenOldridge Mar 4, 2020
5bff3e7
Clarify intent for type checking mechanics
Mar 4, 2020
1ee72f3
Merge pull request #202 from qlzh727/master
Mar 4, 2020
5a853a7
Update 20191016-dlpack-support.md
EvenOldridge Mar 4, 2020
5cd0967
Update 20191016-dlpack-support.md
VoVAllen Mar 5, 2020
10b82e0
Merge pull request #4 from VoVAllen/patch-3
EvenOldridge Mar 5, 2020
cb1f36d
Add @ematejska to code owners for sig/swift (#212)
Mar 6, 2020
69b7275
RFC: TensorFlow Official Model Garden Redesign (#130)
rachellj218 Mar 6, 2020
c0d4f5d
Initial RFC for single-client parameter server training.
Mar 6, 2020
14f85c4
Remove rebuild_arbitrary_future.png
Mar 7, 2020
f3b8275
Use a smaller png.
Mar 7, 2020
6d3fc13
Fix small typos.
Mar 7, 2020
55c142a
Fix extra period.
rchao Mar 7, 2020
bff1ff6
Merge pull request #1 from rchao/patch-1
Mar 7, 2020
f692cc0
Add section on protocol for custom Tensors
Mar 7, 2020
1b20c1f
Add open question about legacy API
Mar 7, 2020
451b627
Add discussion topic for tf.TypeSpec
Mar 10, 2020
6e75f04
Add one more paragraph for single client
Mar 12, 2020
651c0cb
changes
alextp Aug 17, 2018
6a8e4a0
changes
alextp Aug 17, 2018
efbb162
fix link
alextp Aug 22, 2018
89ba29d
..
alextp Mar 16, 2020
9b4c282
.
alextp Mar 16, 2020
0415879
new-rfc
alextp Dec 21, 2018
6fbc0f0
changes
alextp Dec 6, 2019
9853bd1
oops
alextp Dec 6, 2019
57528b6
added docstring link
alextp Dec 9, 2019
6b6dfe9
style is a section header
alextp Dec 9, 2019
34e8f54
strings over enums
alextp Dec 16, 2019
2b916a8
changes
alextp Mar 16, 2020
614bb25
s/tf-api/owners/ tensorflow/api-owners'
alextp Mar 16, 2020
c6dc8b1
final touches
martinwicke Mar 16, 2020
6f939e5
Merge pull request #185 from alextp/api-reviews
alextp Mar 16, 2020
c3a1c2d
Detail the relationship with tf.TypeSpec
Mar 17, 2020
4f31a44
Update based PR comments.
Mar 18, 2020
f551da1
Formatting
Mar 20, 2020
cbe5eaf
Draft guidance for adding new types
Mar 20, 2020
b8aae73
Minor edit
Mar 20, 2020
e7b0fef
Use a proper example for type annotations
Mar 20, 2020
8797e73
Update 20200211-tf-types.md
Mar 20, 2020
882dbb6
Fix typo.
Mar 20, 2020
97d5d8d
Clarify that example is non-prescriptive
Mar 21, 2020
e86de57
Update status to proposed
Mar 21, 2020
fac8975
Update time stamp
Mar 21, 2020
9c2f37f
Fix typo
Mar 21, 2020
8e47bc1
Slight update to example
Mar 21, 2020
bc33a1a
Add link to an example
Mar 24, 2020
af51680
Add design review notes
Mar 24, 2020
c8816c4
Fix indentation in notes
Mar 24, 2020
327ceda
Minor updates following design review
Mar 24, 2020
aeff124
Update status
Mar 24, 2020
81a669c
Merge pull request #208 from mdanatg/master
Mar 25, 2020
14b28d6
Optional arguments with defaults.
jsimsa Mar 25, 2020
2a2ca08
Fix typo.
jsimsa Mar 25, 2020
d628486
* Updated procedure (#203)
seanpmorgan Mar 30, 2020
bdc6dad
Update 20200306-single-client-parameter-server.md
Mar 31, 2020
c0929ea
experimental API policy
alextp Mar 16, 2020
b275934
clarifying known deficiency
alextp Mar 16, 2020
6e4cd52
Update governance/api-reviews.md
alextp Mar 20, 2020
cf483b8
Update governance/api-reviews.md
alextp Mar 20, 2020
581d21a
clarifications
alextp Mar 20, 2020
eb15bc4
clarify policy for stuff which keeps changing
alextp Apr 6, 2020
cd8f9ca
reference experimental section from other places
alextp Apr 6, 2020
62e34f5
clarify addons
alextp Apr 6, 2020
9cdd68b
RFC: FuseRecv
liutongxuan Apr 9, 2020
ab0f433
Update 20200306-single-client-parameter-server.md
Apr 10, 2020
6fa632a
Change the status to accepted
Apr 10, 2020
5466bb0
Merge pull request #214 from yuefengz/master
Apr 10, 2020
e3ae9a5
Merge pull request #209 from tanzhenyu/master
Apr 10, 2020
5f54a30
Fix irregular writing and expression issues.
jbedorf Apr 11, 2020
57ee7b2
update reviewers and submit time
liutongxuan Apr 11, 2020
b005a46
update sponsor
liutongxuan Apr 14, 2020
1cd7baf
Update faq.md (#205)
LexusH Apr 14, 2020
123ea17
Fixed broken link for Bug & Performance issues (#216)
ashutosh1919 Apr 14, 2020
c1d4c1b
Merge pull request #182 from annarev/pip_structure_rfc
Apr 14, 2020
4ea7cb0
Mark RFC as implemented
Apr 14, 2020
1b2fb4d
Merge pull request #228 from tensorflow/ematejska-patch-2
Apr 14, 2020
43397da
Merge pull request #169 from underscoreanuj/master
Apr 14, 2020
15030e3
Updated this to accepted.
Apr 15, 2020
dc06c7a
Merge pull request #180 from EvenOldridge/EvenOldridge-dlpack-support
Apr 15, 2020
af8ab47
fix typo
liutongxuan Apr 15, 2020
3ab274c
Update CHARTER.md (#229)
jsimsa Apr 15, 2020
9070634
Updates after design review. Design accepted.
mmilanifard Apr 15, 2020
1d588c4
Merge pull request #186 from mmilanifard/master
Apr 15, 2020
7d33372
Create SIG Graphics charter
theadactyl Apr 17, 2020
fad8d7a
Update CHARTER.md
theadactyl Apr 17, 2020
2415103
Merge pull request #231 from tensorflow/theadactyl-patch-1
theadactyl Apr 17, 2020
0766195
Update CHARTER.md
theadactyl Apr 17, 2020
a97de0f
Fix markdown formatting in SIG Graphics charter
terrytangyuan Apr 18, 2020
f5742df
Merge pull request #233 from terrytangyuan/patch-1
theadactyl Apr 19, 2020
912657c
Update to set the status to proposed.
Apr 21, 2020
a74568c
Updating the Proposed status to Accepted for these merged RFCs. (#235)
Apr 21, 2020
cb73a17
Merge pull request #194 from arnoegw/patch-1
Apr 21, 2020
84b5ba5
Update dead link in charter.md (#189)
JaccovG Apr 22, 2020
007219c
Merge branch 'master' into theadactyl-patch-2
theadactyl Apr 24, 2020
44159ab
Add files via upload
1025KB Apr 24, 2020
3c39017
Merge pull request #1 from 1025KB/1025KB-patch-2-1
1025KB Apr 24, 2020
877a03a
Delete cloud.png
1025KB Apr 24, 2020
bd376ad
Delete parallel_tuning.png
1025KB Apr 24, 2020
352cce6
Delete workflow.png
1025KB Apr 24, 2020
c1da034
Create 123
1025KB Apr 24, 2020
9cc6552
Add files via upload
1025KB Apr 24, 2020
55a50fe
Delete 123
1025KB Apr 24, 2020
16fbadf
Update 20200420-tfx-tuner-component.md
1025KB Apr 24, 2020
e534195
RFC: Tensorflow SavedModel C/C++ API
bmzhao Feb 20, 2020
42fca19
Mark as Accepted.
Apr 24, 2020
5a4ca3c
Merge pull request #207 from bmzhao/tf-c-saved-model
Apr 24, 2020
49c9f13
Add C++ style guide.
aaudiber Apr 30, 2020
7a2a5d5
Merge pull request #232 from tensorflow/theadactyl-patch-2
theadactyl May 8, 2020
f4b925c
Update user API and op definition based on comments.
liutongxuan May 12, 2020
d1c022d
Merge pull request #236 from 1025KB/master
May 12, 2020
12f4414
Merge pull request #224 from liutongxuan/master
May 12, 2020
8ae88c1
Introducing Transactions extension to Modular Filesystems RFC
samikama Apr 24, 2020
afa6478
Add CSRSparseMatrix RFC.
penpornk May 20, 2020
3574458
Adjust image sizes.
penpornk May 20, 2020
4fc8600
Fix an image's path.
penpornk May 20, 2020
8f0975c
Add a discussion point about CompositeTensor.
penpornk May 20, 2020
d497090
Update the RFC #.
penpornk May 20, 2020
d25b2e5
Create RFC for TensorFloat-32 support in TensorFlow
reedwm May 20, 2020
2826217
Update RFC link to point to PR
reedwm May 21, 2020
3664d6b
Address review comments.
reedwm May 21, 2020
b2d5d47
Address review comments
reedwm May 21, 2020
1d34ede
Address comments
reedwm May 21, 2020
bab620f
Added updates from discussions
samikama May 24, 2020
6a8f789
* gelu migration RFC
seanpmorgan May 26, 2020
8fc2dd3
typos
seanpmorgan May 27, 2020
a3b8b6d
Spacing
seanpmorgan May 27, 2020
8f1af58
* Update transition
seanpmorgan May 28, 2020
67c0e2a
Add information about documentation and tutorial.
penpornk May 28, 2020
ec1dff5
Add some more info on remote devices
reedwm Jun 1, 2020
89f6244
Clarify why COO is not efficient with common TF sparsities
penpornk Jun 2, 2020
0a2db5d
Add Keras activations
seanpmorgan Jun 2, 2020
1c2bca8
Add RFC number
seanpmorgan Jun 2, 2020
ac4ae7f
Removing device part of the proposal
annarev Jun 3, 2020
a926a55
Changed "Updated" date
annarev Jun 3, 2020
6626197
Marked as accepted.
Jun 3, 2020
1cb9a94
Merge pull request #247 from reedwm/tf32
Jun 3, 2020
135293e
Moving to Accepted
Jun 4, 2020
5001b24
Merge pull request #133 from sjamesr/add_kernel_rfc
Jun 4, 2020
1ed6b44
RFC for advanced TFX DSL semantics
ruoyu90 Jun 4, 2020
512619d
Remove unnecessary token arguments from stateful tokens example
samikama Jun 5, 2020
102bc5f
Fixed format
ruoyu90 Jun 5, 2020
4b6c81a
Fixes table format.
ruoyu90 Jun 9, 2020
7b62b5b
Update 20200420-tfx-tuner-component.md
1025KB Jun 12, 2020
462ff49
Merge pull request #256 from 1025KB/patch-2
theadactyl Jun 12, 2020
1b0af45
Create 20200616-keras-multihead-attention.md
saberkun Jun 17, 2020
ec047a9
Update 20200616-keras-multihead-attention.md
saberkun Jun 17, 2020
0472095
Update 20200616-keras-multihead-attention.md
saberkun Jun 17, 2020
6b1b201
Update 20200616-keras-multihead-attention.md
saberkun Jun 17, 2020
40b799b
Update 20200616-keras-multihead-attention.md
saberkun Jun 17, 2020
33b20f1
Use the mask_tensor inside the example code.
saberkun Jun 18, 2020
2f24acb
This has been accepted.
Jun 18, 2020
52e920c
Update the RFC based on comments.
penpornk Jun 19, 2020
0ad6e24
Updating future works to emphasize `TriggerPolicy`
ruoyu90 Jun 19, 2020
e618aa5
Marking as Accepted.
Jun 22, 2020
cd9164b
Merge pull request #253 from ruoyu90/async
Jun 22, 2020
57e8824
Add references for deep learning sparsities.
penpornk Jun 22, 2020
a4c39aa
Merge pull request #246 from penpornk/master
Jun 25, 2020
b3daa1d
Update 20200616-keras-multihead-attention.md
saberkun Jun 26, 2020
25c4309
Adding modifications for merged proposal
samikama Jul 2, 2020
84519a1
Update 20200505-transactional-fs.md
Jul 8, 2020
4ffd127
Update 20200616-keras-multihead-attention.md
Jul 8, 2020
cd7a634
Added transactional checkpointing example and possible implementation…
samikama Jul 12, 2020
378feee
Update Keras categorical input design, mark it as complete.
tanzhenyu Jul 15, 2020
4d8e61e
Address comments.
tanzhenyu Jul 15, 2020
5507ba0
Fix some punctuation.
tanzhenyu Jul 15, 2020
6cd4091
Merge pull request #267 from tanzhenyu/master
Jul 15, 2020
00d1976
Mark as Accepted
Jul 15, 2020
5f3e443
Merge pull request #245 from samikama/sami_transactional_fs
Jul 15, 2020
cff3725
* Marking RFC as completed
seanpmorgan Jul 16, 2020
cced595
Merge pull request #252 from seanpmorgan/gelu-migration
Jul 16, 2020
9778f63
Update two proposed changes
saberkun Jul 20, 2020
72c0662
Update to accepted
saberkun Jul 20, 2020
c3d9d99
Merge pull request #260 from saberkun/patch-1
Jul 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Custom issue template
about: For community repo issues
title: ''
labels: ''
assignees: ''

---

# Community repo

The only issues you should file here concern the community's documentation or processes.

All other bugs should be filed on the appropriate repo, questions directed to the various email groups, or if it's a "how-to" question, StackOverflow.
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ sigs/io/ @martinwicke @ewilderj @mrry @yongtang @dmitrievanthony
sigs/jvm/ @martinwicke @ewilderj @sjamesr @karllessard @tzolov
sigs/micro/ @martinwicke @ewilderj @petewarden
sigs/mlir/ @ewilderj @pkanwar23
sigs/swift/ @ewilderj @saeta @dynamicwebpaige
sigs/swift/ @ewilderj @saeta @ematejska
sigs/testing/ @ewilderj @dynamicwebpaige

# RFCs

rfcs/ @ewilderj @martinwicke @goldiegadde
rfcs/ @ewilderj @martinwicke @theadactyl @ematejska
268 changes: 268 additions & 0 deletions governance/api-reviews.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
# tensorflow/api-owners review practices

## Overview

This is an attempt to gather commonly discussed topics when doing API
reviews. It’ll hopefully be a useful resource to both API owners and people
proposing API changes. [TF API Owners](https://github.com/orgs/tensorflow/teams/api-owners)
meet twice weekly to discuss changes. We try to get to PRs on the next meeting,
but we don’t always make it all the way through. If your change is particularly
urgent, please ping the PR to notify us of any urgency.

## Process

We only look at changes which have already been approved by other reviewers. If
there are major outstanding comments, we will wait with API review until those
are resolved. If there are questions for API owners, explicitly raise this in
the comments to get an answer.


## High level points

### Backward and forward compatibility
We avoid backwards-incompatible API changes. We also avoid
backwards-incompatible behavior changes, such as restricting the set of valid
inputs to a function or extending the set of valid outputs of a function. Adding
support for previously not supported behavior is okay, as are changes to
explicitly experimental APIs (see section below). When needing to provide a new
or different behavior, we strongly prefer a new version of the API over breaking
backwards compatibility. Note that we are free to deprecate APIs; we just cannot
break code which relies on their documented behavior. We need to worry about
backward compatibility both of our python APIs and of the serialized GraphDefs,
and in general breaking serialized GraphDefs is worse than breaking the python
APIs.

Forward compatibility is more subtle: we should avoid changing the graph
produced by currently correct python code without a three weeks notice. This
comes up most frequently when adding new ops, but also applies to non-obvious
things such as the graph emitted by gradients or pfor.


### Docstrings

TF APIs should have comprehensive documentation in the form of docstrings. If at
all possible these docstrings should have runnable examples, and these examples
should form a doctest so they stay correct. The examples should demonstrate an
end-to-end user workflow, such that it’s clear how to generate the necessary
inputs for the API and what to do with the outputs. The docstring should be
understandable by someone who is not familiar with TF. See the [guide to writing
TF docstrings](https://www.tensorflow.org/community/contribute/docs_ref) for
more information.

Our documentation generator for classes only sees methods, so prefer defining
members as properties instead of assigning them in `__init__`.

Docstrings should only refer to other public TF API symbols (i.e. do not refer
to other symbols defined in the same file as a function which is just now being
made public) and should refer to public API symbols by their full exported name.

### Common names

Prefer keepdims over keep_dims. Prefer axis over dim. Data types are called
dtype. name is a common last argument of ops but backward compatibility mandates
that new arguments are added after the last existing argument, even if that
results in name not being the last argument.

We generally prefer spelling things out over using abbreviations except when
abbreviations are more standard than spelling things out (i.e. don’t spell out
linalg or svd). When in doubt we ask domain experts or use web search to see
what spelling is most common.

If possible we prefer to name things in a similar way to numpy (e.g., we would
not pick einsum as a name, but numpy and others before it have, and that
precedent is very strong).

We prefer experimental namespaces (i.e. tf.data.experimental.foobar) over
experimental-prefixed names (i.e. tf.data.experimental_foobar) except when
adding an experimental class method, or an experimental argument. Experimental
endpoints should be deprecated in a minor release before they can be removed in
the next. We would like new experimental symbols to be things which will
eventually end up in core TF as opposed to things we expect will be phased out
with no clear replacement. The best expectation to have for an experimental
endpoint is that the “experimental” will simply be removed. If you don’t believe
that’ll work, it should probably not be added in its current form.

### Style

Generally, follow Google style.

Avoid redundancy. Do not write arguments of the form `function(...,
enable_feature=False, feature_config=None)` if you can also write `function(...,
feature_config=None)`, where implicitly, `enable_feature = feature_config is not
None`.

Try to embed well with the ambient language. Think about how your API interacts
with language idioms (e.g., in Python: can it be hashed, i.e., used as a dict
key? Is it iterable? Is it a mapping? Can it be equality compared?
Ordered?). Think about how your API interacts with other pieces of the Python
ecosystem as well— is there an analogue in Numpy or PyTorch that we should
consider aligning with?

Use language-native constructs wherever you can. In Python, a tuple should be a
tuple. The bar for custom configuration objects is relatively high, a dict or
namedtuple goes a long way.

In particular, do not expose protobufs directly as part of an API. You can use
protobufs for serialization or to encode network traffic. Protobufs should
always be an implementation detail, and never visible on the API surface. Use
language native constructs (dicts or classes for Python, structs for C/C++) if
you need configuration objects.

Avoid global (or any non-local) state as much as possible (this includes Python
'with' scopes). If you need global context, consider whether it can be
thread-local. The TF API is supposed to be thread-safe. Avoid stateful operation
(mutability) if you can. Both features make it hard to reason about code, and
make composability harder to achieve.

We prefer strings ("auto", "never", etc) over enums (tf.namespace.AUTO,
etc). Strings are easier to type, and forces us to document all possible values
and their semantics in the docstrings of all places which accept the string, as
opposed to only in the enum definition, which is a little friendlier.

### Orthogonality and integration with the existing APIs

Is the new API implementable in terms of existing APIs? If so, we might want to
consider pointing users to using the existing APIs. Does the new API add enough
value over a combination of existing APIs? Does the API solve only a specific
problem (that’s usually a sign combinations of existing APIs would be
preferred)?

If not, are existing APIs implementable in terms of the new API? If this is
simple, we might want to steer users towards the new and away from the old API
(possibly, old APIs should be deprecated along with introducing the new API).

If neither is the case, it might be possible that there is a more general API
which makes both the existing API and the new API easy to express. We try to
keep global consistency of our API in mind when reviewing new changes.

How will this API work together with others? Does it do something slightly
differently than others? Does it expect inputs which match what other parts of
TensorFlow produce? Does its output match what other parts of TensorFlow can
consume?

Does it do things the same way other similar pieces in TensorFlow do it? E.g.,
if a common pattern to achieve a behavior is an extra argument, don't use a
function decorator to achieve the same in a different area of the API.

Two wrongs don’t make a right. That is, if a bad API already exists in TF, that
does not give license to new APIs to be bad in the same way. Improvement must be
balanced with consistency, however, and sometimes it’s okay to carry small
imperfections into new APIs for the sake of consistency with old APIs.

### Optional arguments with default values

Many APIs have optional arguments with a default value. Our recommendation is to
use `None` as the default value of any optional arguments and have the
implementation be responsible for handling it as opposed to using a default
value that directly represents the behavior (e.g. `aggregate='sum'`). The
latter prevents the implementation from distinguishing between the caller not
setting the argument vs. the caller setting the argument to the default value,
which may be needed when the default behavior is changing.

### Does it belong in TF at all?

As TF evolves there’s a tendency to put everything inside of it, with costs
compounding over the long term. If there is a reasonable home for a new API
outside core TF (say in addons, io, TFP, or other projects entirely) that can be
strongly preferrable. If new code can be released as independent libraries, it
should be. This is especially true for APIs that are actively evolving; core TF
imposes many restrictions, so it’s far better to trial new APIs outside of the
core library.

## Adding new ops

Adding new ops to TF should be done with care. We generally prefer not adding
new ops if possible, but performance, hardware compatibility, and other concerns
often do require new ops.

When adding new ops, look for:

- closure under automatic differentiation (i.e. we avoid ops which are
differentiable but not twice-differentiable, or which are technically
differentiable but not marked as such)
- performant kernels (it’s better not to have an op than to have an op with a
suboptimal kernel; we need to make sure kernel experts have reviewed the
code)
- broadcasting (all numerical ops should broadcast using numpy rules)
- does support for this op have to be added to pfor/vectorized_map?
- dtype support (in general all numerical ops should support the common
integer, floating point, and complex dtypes, if they all make sense; we need
to watch out for int32 on GPUs though)
- device support (cuda kernels should be implemented if possible, and similarly
a tf/xla bridge entry should be added if it makes sense)
- attributes versus inputs (anything which can be an input to an operation
should be an input, and attributes should only be used to parametrize the
operation in ways that affect the output dtypes or sometimes shapes)
- state management (is the op stateful? Can it instead be made stateless and
rely on optimizations like memory reuse for performance? Can it be made to
keep its state using one of the existing mechanisms like variables? If not,
its state should be encapsulated using resource handles if at all possible)
- we generally don’t like ops which are supported only on a single device (be
it CPU, GPU, XLA, TPU, etc) and prefer to have at least a plan for writing
device-agnostic code
- should the python layer for this operation support raggedtensor/sparsetensor?

## Experimental APIs

Experimental APIs are APIs which have the word 'experimental' somewhere in their
name; for example `tf.experimental.foo`, or `tf.foo.experimental.Bar`, or
`tf.foo(experimental_bar=True)` or `tf.Foo().experimental_bar()`. We generally
prefer experimental namespaces when possible, so prefer
`tf.foo.experimental.Bar` over `tf.foo.ExperimentalBar`.

Experimental APIs are APIs intended to be added to TensorFlow as-is, but which
we reserve the right to change in backwards-incompatible ways if we have
to. This is different from apis in `tensorflow/addons`, many of which are not
necessarily intended to be added to core TF as they might have a more narrow use
case initially (if APIs in `tensorflow/addons` do become widely useful they can
"graduate" to core, either using experimental or not).

No temporary APIs should be added to experimental (i.e. "we just need this until
certain bugfix or certain new feature becomes available" is not a valid reason
to add an API with experimental in the name.)

No API with known deficiencies should be added to experimental. Experimental
APIs should, to the best of our knowledge, not be expected to change in a known
way (no argument with a known bad name, etc). Experimental can, however, be used
for APIs which are a work-in-progress: it's fine to add experimental methods to
a base class even if those methods are only implemented on some subclasses as
long as we expect all classes to eventually implement those.

The same amount of due diligence required for a real API is required for an
experimental API: this means tests, benchmarks, documentation, end-to-end
examples, etc

Experimental APIs are not a license to break users. This means:
1. we do not remove experimental APIs which are widely used without an effort
to help migrate users away
2. experimental APIs are not removed without warning and don't have
backwards-incompatible changes made to them without warning (the warning can be
a deprecation on version 2.x and removal on 2.x+1, but plain removal on 2.x
with no notice on 2.x-1 is not ok)

Small changes which are mentioned in relnotes and have obvious fixes might be
made (for example if adding a new argument to a long argument list and we
believe there are few pass-by-position users we might allow the new argument to
be added to the middle and not the end of the parameter list).

Large backwards-incompatible changes to experimental APIs still require an
`experimental_foo_v2` or similar backwards-compatible evolution plan to avoid
breaking users of the existing experimental API.

No API endpoint should stay in experimental forever. If a particular
experimental API hasn't had major changes in two minor releases we should remove
the experimental annotation from the API name or delete it. If we do want to
delete it we need to have a deprecation plan that can migrate all users to some
other API endpoint or composition of existing APIs. In rare cases experimental
APIs can continue to be iterated on after many releases (see TPUStrategy); this
only applies for fairly large API surfaces.

When removing the experimental annotation we should, if at all possible, allow
escape routes to not break existing code. This means toplevel symbols
`tf.experimental.foo` and methods like `tf.Class.experimental_foo` should get a
deprecation warning on 2.x before deletion on 2.x+1; we should use the
doc_controls decorators to not pollute API docs with deprecated "graduated"
experimental APIs. For experimental function arguments we should consider
catching `**kwargs` to raise the proper warnings for at least one version (note
though that `**kwargs` is generally discouraged from our APIs; we prefer
explicitly named keyword arguments if at all possible).
64 changes: 64 additions & 0 deletions governance/cpp-style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# C++ Coding Style

Tensorflow follows [Google C++ style](https://google.github.io/styleguide/cppguide.html),
with a few additions.

## Status

Functions which can produce an error should return a `tensorflow::Status`. To propagate an
error status, use the `TF_RETURN_IF_ERROR` macro.

```
TF_RETURN_IF_ERROR(f());
```

## StatusOr<T>

`StatusOr<T>` is the union of a `Status` object and a `T` object. It offers a way to use
return values instead of output parameters for functions which may fail.

For example, consider the code:

```
Output out;
Status s = foo(&out);
if (!s.ok()) {
return s;
}
out.DoSomething();
```

With `StatusOr<T>`, we can write this as

```
StatusOr<Output> result = foo();
if (!result.ok()) {
return result.status();
}
result->DoSomething();
```

**Pros:**

Return values are
[easier to reason about](https://google.github.io/styleguide/cppguide.html#Output_Parameters)
than output parameters.

The types returned through `StatusOr<T>` don't need to support empty states. To return a type
as an output parameter, we must either use a `unique_ptr<T>` or support an empty state for the
type so that we can initialize the type before passing it as an output parameter. `StatusOr<T>`
reduces the number of objects we have in an "uninitialized" state.

**Cons:**

`StatusOr<T>` adds complexity. It raises questions about what happens when `T` is null and
how `StatusOr<T>` behaves during moves and copies. `StatusOr<T>` also generally comes with
macros such as `ASSIGN_OR_RETURN`, which add additional complexity.

The current Tensorflow codebase exclusively uses `Status` instead of `StatusOr<T>`, so
switching over would require a significant amount of work.

**Decision:**

Tensorflow foregoes the use of `StatusOr<>` because it doesn't add enough value to justify
additional complexity.
Loading