You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
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
+
14
17
15
18
## Motivation
16
19
@@ -27,63 +30,62 @@ rely on the public TF API only, to avoid any future breakages due to private
27
30
method/class change.
28
31
29
32
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.
36
37
37
38
38
39
## Design Proposal
39
40
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.
43
48
44
49
### 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.
56
54
57
55
### Acceptance Criteria
58
-
The candidate of the "internal" API should:
56
+
The candidate of the "_internal" API should:
59
57
60
58
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.
64
62
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)
68
66
69
67
TF API owners will review the new API proposal, and follow the existing review
70
68
process for core TF API.
71
69
72
70
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
+
73
78
### Documentation and Docstring
74
79
The "internal" API should have the same style and standard as the core
75
80
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.
79
83
80
84
### Naming and sub namespace
81
85
Similar "internal" APIs should be grouped together as sub namespaces, e.g., test
82
86
related APIs should live under "tf.internal.test". This is aligned with the
83
87
existing TF naming conversion.
84
88
85
-
Try not to export experimental APIs since the "internal" API should be mature
86
-
enough.
87
89
88
90
### Current candidate
89
91
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.
110
112
to add are still high level APIs and utility functions.
111
113
1. By Martin <b>"tf.\_internal"</b>: the extra "_" emphasis in the pythonic way
0 commit comments