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

Commit 9eb7754

Browse files
committed
Update 20200810-tf-internal-api.md
Update the RFC to reflect the latest status after the design meeting.
1 parent f624eb3 commit 9eb7754

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

rfcs/20200810-tf-internal-api.md

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
# tf.internal API namespace
1+
# tf._internal API namespace
22

33
| Status | Proposed |
44
:-------------- |:---------------------------------------------------- |
55
| **RFC #** | [278](https://github.com/tensorflow/community/pull/278)|
66
| **Author(s)** | Qianli Zhu ([email protected]) |
77
| **Sponsor** | Martin Wicke ([email protected]), Alex Passos ([email protected])|
88
| **Updated** | 2020-08-10 |
9-
| **Intended audience**| tf-api-owners, tf-addons, keras-team, deepmind/sonnet|
9+
| **Intended audience**| tf-api-owners, keras-team|
1010

1111
## Objective
1212

13-
Adding a new "internal" API namespace in TF to host APIs for framework building/testing, etc. The API will have looser contracts compared to core TF API.
13+
Adding a new "_internal" API namespace in TF to host APIs for framework building
14+
/testing, etc. The API namespace will serve as a whitelist for client libraries
15+
to gradually migrate off the usage tf private API symbol.
16+
1417

1518
## Motivation
1619

@@ -27,63 +30,62 @@ rely on the public TF API only, to avoid any future breakages due to private
2730
method/class change.
2831

2932
Historically, Keras was an internal component of TF, and relies heavily on a lot
30-
of private TF utilities and functionalities that are not part of the public API.
31-
Exposing those functions into public APIs will be very confusing to the end
32-
user, since those functions are useful to framework-builders, but not typical
33-
TensorFlow users. In addition, these utilities would be overly restricted by the
34-
standard TensorFlow API contract, as we would like to change/remove them more
35-
often than the existing core API.
33+
of private TF utilities and functionalities that are not part of the public
34+
API. Exposing those functions into public APIs will be very confusing to the
35+
end user who uses tf to build/train models, since those functions are useful to
36+
framework-builders, but not typical TensorFlow users.
3637

3738

3839
## Design Proposal
3940

40-
Add a new namespace "tensorflow.internal" to host the framework building/testing
41-
related APIs. <b>(See alternative naming in the sections below, the naming of
42-
the namespace will be discussed in the design meeting.)</b>
41+
Add a new namespace "tensorflow._internal" to host the framework building/
42+
testing related APIs that are currently used by other high level API in TF
43+
(Keras, and estimator, etc.). This name space will be treated as a protected
44+
API, which shouldn't be used by the end users. It will have no API contract
45+
compared to core TF API. TF side must be aware of the usage from client lib,
46+
so that it can properly test the change to any of those internal API before TF
47+
side making any backward incompatible change.
4348

4449
### Backward compatibility
45-
The contract for all the APIs under this namespace is looser compared to core TF
46-
API. It will remain backward compatible for at least 1 minor TF release.
47-
48-
This means for any API that is added in 2.x release, it will remain the same in
49-
2.x+1. If we choose to remove the same API, we will mark it as deprecated in
50-
2.x+1, and delete it at 2.x+2 release. TensorFlow is released every 3 months,
51-
and this will give enough time for all the clients to change to the new
52-
API/alternative.
53-
54-
Any deprecation and backward incompatible API change will be explicitly called
55-
out in TF release notes. This applies to both core API and "internal" API.
50+
There is no API contract for all the functions under this namespace. TF side
51+
can make any backward incompatible change at any time. To prevent any breakage
52+
caused on the client side, TF must be aware who is using this API, so that any
53+
changes to those API will be verified against the client code.
5654

5755
### Acceptance Criteria
58-
The candidate of the "internal" API should:
56+
The candidate of the "_internal" API should:
5957

6058
1. Does NOT fit for core TF API, otherwise it should be exposed as core TF API.
61-
1. Are effectively required to build/test/deploy a framework or library on top
62-
of TensorFlow, or to integrate such a framework into TensorFlow's API.
63-
1. Mature enough and won't change behavior/interface for every release.
59+
1. Are currently used by other high level API to build/test/deploy a framework
60+
or library on top of TensorFlow, or to integrate such a framework into
61+
TensorFlow's API.
6462
1. Non-trivial, otherwise the function should be copied to the client side.
65-
1. Widely used in the implementation of TF public APIs (i.e. new functionality
66-
isn’t immediately added to the tf.internal namespace)
67-
1. Has at least two downstream libraries which are known to need it.
63+
1. Widely used in the implementation of TF public APIs or test TF related
64+
features. (i.e. new functionality isn’t immediately added to the tf._internal
65+
namespace)
6866

6967
TF API owners will review the new API proposal, and follow the existing review
7068
process for core TF API.
7169

7270

71+
### Lifespan of the internal API
72+
The internal API should serve as a temporary solution for the client side, and
73+
they should gradually migrate to alternative public TF core API, or other
74+
approaches. Once all the usage for a certain internal API has been removed, it
75+
will be deleted from the internal API namespace.
76+
77+
7378
### Documentation and Docstring
7479
The "internal" API should have the same style and standard as the core
7580
TensorFlow API, which is documented [here](https://github.com/tensorflow/community/blob/master/governance/api-reviews.md#docstrings).
76-
We should explicitly list out the difference between "internal" API and core
77-
API, and also choose a different place on tensorflow.org so that existing user
78-
are not confused.
81+
We will hide this from the documentation site, since the end users are the
82+
target audience for this API.
7983

8084
### Naming and sub namespace
8185
Similar "internal" APIs should be grouped together as sub namespaces, e.g., test
8286
related APIs should live under "tf.internal.test". This is aligned with the
8387
existing TF naming conversion.
8488

85-
Try not to export experimental APIs since the "internal" API should be mature
86-
enough.
8789

8890
### Current candidate
8991
The following list is created from the private TF method usage within Keras,
@@ -110,9 +112,3 @@ and will discuss with the API owner on a case to case basis.
110112
to add are still high level APIs and utility functions.
111113
1. By Martin <b>"tf.\_internal"</b>: the extra "_" emphasis in the pythonic way
112114
that this is for private usage.
113-
114-
115-
## Questions and Discussion Topics
116-
117-
1. Naming of the API namespace.
118-

0 commit comments

Comments
 (0)