Repository: magenta/magenta

Issue:
Rename tf.concat_v2 references to tf.concat
We just made the second part of switching argument order of tf.concat. Second step is to rename tf.concat_v2 to tf.concat. The new tf.concat is available in v1.0.0-rc0 release  (https://github.com/tensorflow/tensorflow/blob/v1.0.0-rc0/tensorflow/python/ops/array_ops.py).


Discussion:
It looks like the latest release that has a pip package is 0.12.1. Do you know when 1.0.0-rc0 will be available as a pip package?

https://pypi.python.org/pypi/tensorflow
rc0 won't be available as a pip package. Next release that will be available as a pip package will be 1.0. Do you need pip package to have these changes?
Yes, we need to be able to depend on a pip package listed in our setup.py: https://github.com/tensorflow/magenta/blob/master/magenta/tools/pip/setup.py#L31

Resolving patch:
diff --git a/magenta/models/image_stylization/image_stylization_evaluate.py b/magenta/models/image_stylization/image_stylization_evaluate.py
--- a/magenta/models/image_stylization/image_stylization_evaluate.py
+++ b/magenta/models/image_stylization/image_stylization_evaluate.py
@@ -109,10 +109,10 @@ def _style_sweep(inputs):
               reuse=True,
               normalizer_params=_create_normalizer_params(style_label))
           for _, style_label in enumerate(labels)]
-      return tf.concat_v2([inputs] + stylized_inputs, 0)
+      return tf.concat([inputs] + stylized_inputs, 0)
 
     if FLAGS.style_grid:
-      style_row = tf.concat_v2(
+      style_row = tf.concat(
           [tf.ones([1, FLAGS.image_size, FLAGS.image_size, 3]), style_images],
           0)
       stylized_training_example = _style_sweep(inputs[0])
@@ -123,12 +123,12 @@ def _style_sweep(inputs):
       stylized_style_images = [
           _style_sweep(image) for image in tf.unstack(style_images)]
       if FLAGS.style_crossover:
-        grid = tf.concat_v2(
+        grid = tf.concat(
             [style_row, stylized_training_example, stylized_noise] +
             stylized_evaluation_images + stylized_style_images,
             0)
       else:
-        grid = tf.concat_v2(
+        grid = tf.concat(
             [style_row, stylized_training_example, stylized_noise] +
             stylized_evaluation_images,
             0)
diff --git a/magenta/models/image_stylization/image_stylization_transform.py b/magenta/models/image_stylization/image_stylization_transform.py
--- a/magenta/models/image_stylization/image_stylization_transform.py
+++ b/magenta/models/image_stylization/image_stylization_transform.py
@@ -85,7 +85,7 @@ def _multiple_images(input_image, which_styles, output_dir):
   """Stylizes an image into a set of styles and writes them to disk."""
   with tf.Graph().as_default(), tf.Session() as sess:
     stylized_images = model.transform(
-        tf.concat_v2([input_image for _ in range(len(which_styles))], 0),
+        tf.concat([input_image for _ in range(len(which_styles))], 0),
         normalizer_params={
             'labels': tf.constant(which_styles),
             'num_categories': FLAGS.num_styles,
diff --git a/magenta/models/image_stylization/image_utils.py b/magenta/models/image_stylization/image_utils.py
--- a/magenta/models/image_stylization/image_utils.py
+++ b/magenta/models/image_stylization/image_utils.py
@@ -317,7 +317,7 @@ def load_evaluation_images(image_size):
   evaluation_images = tf.gfile.Glob(glob)
   if not evaluation_images:
     raise IOError('No evaluation images found')
-  return tf.concat_v2(
+  return tf.concat(
       [load_image(path, image_size) for path in evaluation_images], 0)
 
 
@@ -581,7 +581,7 @@ def _parse_example_proto(example_serialized):
   ymax = tf.expand_dims(features['image/object/bbox/ymax'].values, 0)
 
   # Note that we impose an ordering of (y, x) just to make life difficult.
-  bbox = tf.concat_v2([ymin, xmin, ymax, xmax], 0)
+  bbox = tf.concat([ymin, xmin, ymax, xmax], 0)
 
   # Force the variable number of bounding boxes into the shape
   # [1, num_boxes, coords].


Test patch: