Monkey patch tf 1.13 so tfds can use it.

def _patch_for_tf1_13(tf):
  """Monkey patch tf 1.13 so tfds can use it."""
  if not hasattr(tf.io.gfile, "GFile"):
    tf.io.gfile.GFile = tf.gfile.GFile
  if not hasattr(tf, "nest"):
    tf.nest = tf.contrib.framework.nest
  if not hasattr(tf.compat, "v2"):
    tf.compat.v2 = types.ModuleType("tf.compat.v2")
    tf.compat.v2.data = types.ModuleType("tf.compat.v2.data")
    from tensorflow.python.data.ops import dataset_ops
    tf.compat.v2.data.Dataset = dataset_ops.DatasetV2
  if not hasattr(tf.compat.v2.data.Dataset, "output_shapes"):
    from tensorflow.python.data.ops import dataset_ops
    if hasattr(dataset_ops, "get_legacy_output_shapes"):
      tf.compat.v2.data.Dataset.output_shapes = property(
          dataset_ops.get_legacy_output_shapes)
      tf.compat.v2.data.Dataset.output_types = property(
          dataset_ops.get_legacy_output_types)