Skip to content

Minor Python 3 fixups.#1

Open
darrengarvey wants to merge 1 commit intotkarras:masterfrom
darrengarvey:python3-fixups
Open

Minor Python 3 fixups.#1
darrengarvey wants to merge 1 commit intotkarras:masterfrom
darrengarvey:python3-fixups

Conversation

@darrengarvey
Copy link
Copy Markdown

Non-functional changes to run with Python 3.

Incremental printing looks uglier in python 3 unfortunately (print 'foo', => print('foo',end=' ')), but the result should be the same.

Non-functional changes to run with Python 3.
pittacus added a commit to pittacus/progressive_growing_of_gans that referenced this pull request Jul 22, 2018
@gwern
Copy link
Copy Markdown

gwern commented Jan 6, 2019

ProGAN will also need some updates for CUDA 10/the next Tensorflow version, as they move one of the NCCL functions:

diff --git a/tfutil.py b/tfutil.py
index cf7ad0a..af970ed 100755
--- a/tfutil.py
+++ b/tfutil.py
@@ -13,6 +13,7 @@ import imp
 import numpy as np
 from collections import OrderedDict
 import tensorflow as tf
+from tensorflow.python.ops import nccl_ops
 
 #----------------------------------------------------------------------------
 # Convenience.
@@ -328,7 +329,7 @@ class Optimizer:
                     for var_idx, grad_shape in enumerate(self._grad_shapes):
                         g = [dev_grads[dev][var_idx][0] for dev in devices]
                         if np.prod(grad_shape): # nccl does not support zero-sized tensors
-                            g = tf.contrib.nccl.all_sum(g)
+                            g = nccl_ops.all_sum(g)
                         for dev, gg in zip(devices, g):
                             dev_grads[dev][var_idx] = (gg, dev_grads[dev][var_idx][1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants