26

I'm curious about what tf.contrib is, and why the code would be included in TensorFlow, but not in the main repository.

Furthermore, looking at the example here (from the tensorflow master branch), and I want to find the source for tf.contrib.layers.sparse_column_with_hash_bucket.

It seems like some cool routines, but I wanted to make sure they were properly using queues, etc, for pre-fetching/pre-processing examples to actually use them in a production setting.

It appears to be documented here, but it is from the tflearn project, but tf.contrib.layers.sparse_column_with_hash_bucket doesn't seem to be in that repository either.

1 Answer 1

43

In general, tf.contrib contains contributed code. It is meant to contain features and contributions that eventually should get merged into core TensorFlow, but whose interfaces may still change, or which require some testing to see whether they can find broader acceptance.

The code in tf.contrib isn't supported by the Tensorflow team. It is included in the hope that it is helpful, but it might change or be removed at any time; there are no guarantees.

The source of tf.contrib.layers.sparse_column_with_hash_bucket can be found at

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/layers/python/layers/feature_column.py#L365

3
  • 6
    contrib stands for CONTRIButions
    – jorgemf
    Jun 27, 2016 at 20:40
  • 1
    I believe it is important to point out that tf.contrib has been removed from Tensorflow starting with version 2.0.alpha. Some of the functionalities in the old tf.contrib package have been moved to tensorflow/addons, but not all of those. For anyone in need of porting an old contrib feature to TF 2.0, you might find some useful info here. Apr 13, 2020 at 15:58
  • Hey, tf.contrib is removed from TF 2.0 onwards. How do we contrib to tensorflow in that case?
    – Trect
    Dec 27, 2020 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.