Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit c0929ea

Browse files
alextpmartinwicke
authored andcommitted
experimental API policy
1 parent d628486 commit c0929ea

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

governance/api-reviews.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,56 @@ When adding new ops, look for:
210210
it CPU, GPU, XLA, TPU, etc) and prefer to have at least a plan for writing
211211
device-agnostic code
212212
- should the python layer for this operation support raggedtensor/sparsetensor?
213+
214+
## Experimental APIs
215+
216+
Experimental APIs are APIs which have the word 'experimental' somewhere in their
217+
name; for example `tf.experimental.foo`, or `tf.foo.experimental.Bar`, or
218+
`tf.foo(experimental_bar=True)` or `tf.Foo().experimental_bar()`.
219+
220+
Experimental APIs are APIs intended to be added to TensorFlow as-is, but which
221+
we reserve the right to change in backwards-incompatible ways if we have
222+
to.
223+
224+
No temporary APIs should be added to experimental (i.e. "we just need this until
225+
certain bugfix or certain new feature becomes available" is not a valid reason
226+
to add an API with experimental in the name.)
227+
228+
No API with known deficiencies should be added to experimental. Experimental
229+
APIs should, to the best of our knowledge, not be expected to change in a known
230+
way (no argument with a known bad name, etc).
231+
232+
The same amount of due diligence required for a real API is required for an
233+
experimental API: this means tests, benchmarks, documentation, end-to-end
234+
examples, etc
235+
236+
Experimental APIs are not a license to break users. This means:
237+
1. we do not remove experimental APIs which are widely used without an effort
238+
to help migrate users away
239+
2. experimental APIs are not removed without warning and don't have
240+
backwards-incompatible changes made to them without warning (the warning can be
241+
a deprecation on version 2.x and removal on 2.x+ 1, but plain removal on 2.x
242+
with no notice on 2.x-1 is not ok)
243+
244+
Small changes which are mentioned in relnotes and have obvious fixes might be
245+
made (for example if adding a new argument to a long argument list and we
246+
believe there are no pass-by-position users we might allow the new argument to
247+
be added to the middle and not the end of the parameter list).
248+
249+
Large backwards-incompatible changes to experimental APIs still require an
250+
`experimental_foo_v2` or similar backwards-compatible evolution plan to avoid
251+
breaking users of the existing experimental API.
252+
253+
No API endpoint should stay in experimental forever. If a particular
254+
experimental API hasn't had major changes in two minor releases we should remove
255+
the experimental annotation from the API name or delete it. If we do want to
256+
delete it we need to have a deprecation plan that can migrate all users to some
257+
other API endpoint or composition of existing APIs.
258+
259+
When removing the experimental annotation we should, if at all possible, allow
260+
escape routes to not break existing code. This means toplevel symbols
261+
`tf.experimental.foo` and methods like `tf.Class.experimental_foo` should get a
262+
deprecation warning on 2.x before deletion on 2.x+1; we should use the
263+
doc_controls decorators to not pollute API docs with deprecated "graduated"
264+
experimental APIs. For experimental function arguments we should consider
265+
catching **kwargs to raise the proper warnings for at least one version.

0 commit comments

Comments
 (0)