Sunsetting tf.contrib

April 9, 2019 ยท View on GitHub

Tranquil Sunset

StatusAccepted
Author(s)Martin Wicke (wicke@tensorflow.org)
SponsorEdd Wilder-James (ewj@tensorflow.org)
Updated2019-04-09

Objective

The tf.contrib module plays several important roles in the TensorFlow ecosystem: It has made it easy for members of the community to contribute to TensorFlow, and have their contributions tested and maintained. It is also used as a staging ground to test early-stage and experimental features in TensorFlow.

However, as the community has grown, the lack of scalability of the current approach for maintaining and supporting tf.contrib has become apparent.

This RFC is a proposal to sunset the present tf.contrib, and replace its important functions with more maintainable alternatives. Note that it also affects some non-contrib code which is not part of the tensorflow module.

Motivation

tf.contrib serves the following functions:

  • Members of the community can submit code which is then distributed with the standard TensorFlow package. Their code is reviewed by the TensorFlow team and tested as part of TensorFlow's tests.
  • Additions to TensorFlow can be tested without falling under the API stability guarantees imposed by semver. New features in TensorFlow is often staged in tf.contrib before being "moved to core", where it falls under API stability guarantees.

tf.contrib is organized in "projects". Each project's code is located in a subdirectory of tensorflow/contrib. There are currently 107 of such projects in tf.contrib. Each project is nominally maintained and supported by its owners. However, adherence to and enforcement of this rule has been weak, and most projects are effectively maintained by the TensorFlow team.

This leads to some issues with tf.contrib:

  • The barrier to contribution is too high. Because all code contributed to tf.contrib becomes part of the TensorFlow distribution, and because the TensorFlow team effectively assumes maintenance responsibilities for it, it has to be thoroughly reviewed. Even reviewing code for addition to contrib can take a long time.
  • tf.contrib is not actively maintained and the quality of its content is highly variable. Many of the projects in tf.contrib are long deprecated, though rarely formally. Many more have been abandoned by their original owners, or have been left unsupported and unmaintained for long periods of time.
  • Even where projects in tf.contrib are vigilantly maintained and enthusiastically supported, issues with and PRs for these projects are all mixed together in the rather unwieldy TensorFlow GitHub issue and PR trackers. No matter how well supported, the TensorFlow team still carries the burden of issue triage and PR management for all projects in tf.contrib.

Design Proposal

This RFC argues that the tf.contrib has outlived its utility and should be retired. Each project in contrib has one of three options for its future: move to core; move to a separate repository; or delete. This decision will be made with the project owners, a proposal for all projects is below, most of which have been reviewed with the respective project owners.

Moving to core

Some projects in tf.contrib have incubated successfully, and their content should be moved to TensorFlow. Examples are tf.contrib.lite, tf.contrib.eager or tf.contrib.tpu. Such a move will require an RFC, and is reserved for projects which are mature, useful for a large fraction of users, and which can be maintained by the TensorFlow team.

For parts of these projects for which the exact API remains unclear, symbols should be prefixed with experimental. We have created an exception in our API stability guarantees for all symbols (functions, classes, methods, modules, or arguments) which begin with experimental. We reserve the right to change or remove these at will, or change their behavior.

Moving to a separate repository

To provide an alternative avenue for contributed code, one or several new repositories will be created which are maintained by the community. Some larger projects, especially those which are likely to be interesting to a distinct community, are best moved into their own repository, and maintained by a SIG (which needs to be formed). A successful example of this is tf.contrib.probability, which has moved to tensorflow/probability.

At least one such SIG should be formed which will maintain a "generic" TensorFlow contrib repository. This can contain community-contributed code which doesn't belong to a larger project, but which is useful for the TensorFlow community. Examples of such contributions include specialized and possibly rarely used ops or layers. The scope of such a repository should be kept reasonably focused (e.g., only ops, Layers, Metrics, Optimizers, Initializers) as to allow its maintainers to actually maintain the code.

While the exact operating modalities for this repository will be up to the SIG, we propose to create the repository tensorflow/addons. The TensorFlow team will provide test infrastructure similar to what is running for TensorFlow (though potentially with reduced platform coverage, TBD). The code in tensorflow/addons should be written against an installed version of TensorFlow (i.e., using import tensorflow as tf, not the direct file imports used currently), and using only public APIs.

Importantly, the content of this repository will not be included in the TensorFlow pip package, but is instead independently distributed. If the SIG chooses, it can release a separate pip package. The TensorFlow team can assist in setting up a build and release workflow.

Even with such a repository available, it is important that TensorFlow related code created by the community is easy to find and use. To this end, we will enhance the community repository to contain an index of community projects. We invite all who have created tensorflow-related code to add their project there. To simplify the process of publishing your code in a usable form, we will also publish a template repository which shows how to set up a TensorFlow-related repository including a proper build against TensorFlow, tests, and distribution via a pip package.

Deleting

Projects that cannot be maintained elsewhere, or which nobody is willing to maintain, will be removed from distribution with the release of TensorFlow 2.0. The TensorFlow 2.0 pip package will not include tf.contrib. The code for tf.contrib will be removed from the master branch once 2.0.0-RC0 is released, but will of course remain available on 1.x release branches.

Note that a lot of projects are currently marked for deletion. This is not a reflection of the viability or quality of these projects, but rather due to the fact that no owner willing to maintain this project separately has been identified yet. If you see a project that you would like to maintain going forward, feel free to either initiate the process of forming a SIG to maintain it in the TensorFlow community umbrella, or simply fork the code. TensorFlow is free software.

List of Projects

This section lists the possible fate of all projects currently in tf.contrib. The decisions here are preliminary, not all owners have been contacted (those marked with a * have not). Named in parentheses are people with a potential interest in this, but who are not owners.

If you have an interest in one of these projects and are not named as an owner (or as an interested party), please speak up. I've added some (tentative) move targets to as of yet nonexistent repositories: tensorflow/io, tensorflow/addons (I would prefer a better name for this), and tensorflow/scientific will all require new SIGs to maintain them.

Note that any project that has no other fate specified (including those moving to a repo tentatively maintained by a SIG, but for which no SIG is actually formed) will be deleted by default at 2.0.

ProjectOwner(s)Fate
tools/graph_transformspetewardendelete (replaced by grappler)
tools/quantizationpetewardendelete (part of tflite)
all_reducepoxvoculidelete (replaced by DistributionStrategy)
androidpetewardendelete (redundant: tflite/ARM build)
autographalexbwmove to core
batchingchrisolstondelete
bayesflowjvdillondelete (moved to tensorflow/probability)
benchmark_toolssaetadelete
bigtablesaetamove to tf.data
boosted_treesnataliaponomarevadelete (moved to core)
checkpointallenlavoiemove to core
cloudsaetamerge with bigtable/
cluster_resolverfrankchnmove to core
cmakemrrydelete (replaced with bazel)
codernickj-google jonycgn sungjinhwangmove to tensorflow/compression
compilertatatoddmove to core
constrained_optimizationacottermove to separate repo
copy_graphdelete (no owner)
crfmerge into tensorflow/probability?
cudnn_rnndelete (available in tf.keras.layers)
datamrrydelete (moved to core)
decision_treessalehaydelete
deprecateddelete (deprecated)
distributejosh11b priyagmove to core
distributionsjvdillondelete (moved to tensorflow/probability)
eagerasimshankarmove to core
estimatorispirmustafa mikecasemove to tensorflow/estimator
factorizationagarwal-ashishdelete (rebuild in core pending)?
feature_columnispirmustafamove to core (experimental)
ffmpegfredbertschdelete
frameworkpartially move to core, delete the rest
fused_convdelete
ganjoel-shormove to separate repo
gdr*byronyi (poxvoculi)
graph_editorpurpledogdelete
grid_rnn(qlzh727 ebrevdo)delete
hadoopyongtang (mrry)move to tensorflow/io?
hooksispirmustafadelete (already in core)
hvxsatok16delete (redundant with NNAPI)
igfs (#22194)dmitrievanthonymove to tensorflow/io
ignite (#22210)dmitrievanthonymove to tensorflow/io
imagepartial move to tensorflow/addons
input_pipelinerohan100jaindelete
integrateshoyer *mcorammove to tensorflow/scientific?
kafkayongtang (mrry)move to tensorflow/io?
kerasfcholletdelete (moved to tf.keras)
kernel_methodspetrosmol rostamimove to tensorflow/estimator?
kfacduckworthddelete (moved to tensorflow/kfac)
kinesisyongtang (mrry)move to tensorflow/io?
labeled_tensorshoyerdelete
layerspartial move to tensorflow/addons
learnwickedelete (replaced by tensorflow/estimator)
legacy_seq2seqebrevdo (qlzh727)delete (replaced by seq2seq)
libsvmdelete (no owner)
linalgrmlarsen langmoredelete (moved to core)
linear_optimizerpetrosmol (karmel)move to tensorflow/estimator
liteaselle petewardenmove to core
lookupysuematsu (ebrevdo)move to core
lossespartial move to tensorflow/addons
makefilepetewardendelete (RPI build now uses bazel)
memory_statswujingyuedelete
meta_graph_transformpetewardendelete
metricsbrainnoisedelete (replaced with OO metrics)
mixed_precisionprotoget reedwmdelete
model_pruningsuyogguptamove to core
mpi(poxvoculi)
mpi_collectives*jthestness (poxvoculi)
nccl(tobyboyd)move essential parts to core
nearest_neighbordelete
nnpartial move to tensorflow/contrib?
opt*joshburkart apassospartial move to tensorflow/addons
optimizer_v2josh11bmerge to core
periodic_resampledelete (no owner)
pi_examplespetewardendelete (will need new examples)
predictorispirmustafa karmeldelete (replaced by tfhub)
protojsimsa ebrevdomove to core
quantizationpetewardendelete (absorbed into tflite)
quantizesuharshs
rateitsmeolivia
receptive_field
recurrentdrpngx zffchen78replaced with new RNN API?
reduce_slice_opsdelete (no owner)
remote_fused_graphsatok16
resamplerfabioviola kosklainmove to tensorflow/scientific?
rnnebrevdo (scottzhu)replace with new RNN API
rpcebrevdo jsimsa
saved_modelkarmelmove to core
seq2seqebrevdo (scottzhu)adapt, move to tensorflow/addons
session_bundledelete (replaced by SavedModel)
signalrryanmove to core (replace existing) or tensorflow/scientific?
slimsguadamove to tensorflow/models?
solversrmlarsenmove to tensorflow/scientific?
sparsemaxmove to tensorflow/addons
specsdelete
stagingdelete (redundant)
stat_summarizerdelete (no owner)
stateless(*ebrevdo *girving)replace our random ops with this?
summarynickfeltmove to core, replacing tf.summary
tensor_forestnataliaponomareva yupbankdelete (moving to core)
tensorboardnickfelt jartmove to tensorflow/tensorboard
tensorrttobyboyd *samikama *aaroey *jjsjann123move essential parts to core
testingispirmustafamove to core, make private
textpartial move to tensorflow/addons
tfprofdelete (replaced by tf.profiler)
timeseriesbananabowl karmel terrytangyuanmove to tensorflow/estimator
tpusaetamove to core
trainingebrevdo sguada joel-shor
utildelete (no owner), or move to tools
verbs(mrry tucker)delete (no owner)

For a more detailed and constantly evolving symbol map, please refer to this document.

Questions and Discussion Topics

  • Who will maintain tensorflow/addons, tensorflow/scientific, and tensorflow/io? I have an initial list, but a SIG is better with more people to share the load (and fame!). I am taking names, please email community-team@tensorflow.org directly. Once a critical mass of maintainers are identified, we will form a SIG and we can discuss what should go it in (and importantly, what should not).
  • What's a better name for tensorflow/contrib? I would like to get rid of the name contrib to avoid confusion.
  • Which groups of projects currently slated for deletion should live together in a new repo? Who will maintain them?