tensorflow / tensorflow/tensorboard

Reduce usage of tf.compat.v1 APIs

Open
#1,718 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tf-2.0 type:cleanup
Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

TensorBoard have migrated to TF 2.0 APIs but there are some usages of V1 APIs due to not-so-compatible changes. Since we are interested in moving off of tf.compat.v1, we will either have to find a replacement or introduce some changes in behavior.

Do note that this list exclude v1 API usages in tests (they are mainly written in graph style and is tracked in #1705) and TB v1 summary.

  • #1725: tf.compat.v1.app -> absl.app
  • #1726: tf.compat.v1.flags -> absl.flags
  • #1733: tf.compat.v1.gfile.GFile -> io.gfile.GFile
  • #1733: tf.compat.v1.gfile.Open -> io.gfile.GFile
  • #1734: tf.compat.v1.image.resize_images -> tf.image.resize
  • #1734: tf.compat.v1.image.resize_nearest_neighbor -> tf.image.resize
  • #1730: tf.compat.v1.GraphDef -> TB proto
  • #1730: tf.compat.v1.MetaGraphDef -> TB proto
  • #1721: tf.compat.v1.RunMetadata -> TB proto
  • #1720: tf.compat.v1.SessionLog -> TB proto
  • #2096: tf.compat.v1.pywrap_tensorflow.NewCheckpointReader -> tf.train.load_checkpoint
  • #2157: tf.compat.v1.checkpoint_exists -> tf.io.gfile.glob() for the prefix
  • tf.compat.v1.Session -> Use eager mode
  • tf.contrib.ffmpeg -> tf.audio.encode_wav or python stdlib's wave module
  • tf.contrib.summary.create_db_writer -> replace with python implementation (obsolete)
  • tf.compat.v1.pywrap_tensorflow.EventsWriter -> migrated to tensorflow.python._pywrap_events_writer private API via #2096 and then #2683.
  • tf.compat.v1.io.tf_record_iterator -> tracked in #1711
  • tf.compat.v1.train.summary_iterator - should become our own wrapper of tf_record_iterator for the places we need it (only tests)
  • #3185: tf.compat.v1.pywrap_tensorflow.PyRecordReader_New -> converted to be only a legacy fallback for when we can't use tf.compat.v1.io.tf_record_iterator

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the remaining unchecked checklist items, especially the tf.compat.v1.Session migration and the summary_iterator work, and read the referenced issue #1711. Trace the current TensorFlow compatibility usage and related tests before deciding the replacement; done means the remaining listed APIs are migrated without breaking the stated test exclusions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.