From 61224fae20d034887d13faaa7413540c599c53d9 Mon Sep 17 00:00:00 2001 From: Isaac Yang Date: Thu, 5 Apr 2018 10:56:38 -0700 Subject: [PATCH] Update for new TF API --- examples/gan/network-celebA.py | 4 ++-- examples/gan/network-mnist.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gan/network-celebA.py b/examples/gan/network-celebA.py index 4ab2855d8..a361d7eb9 100644 --- a/examples/gan/network-celebA.py +++ b/examples/gan/network-celebA.py @@ -347,8 +347,8 @@ def build_model(self): # Extra hook for debug: log chi-square distance between G's output histogram and the dataset's histogram value_range = [0.0, 1.0] nbins = 100 - hist_g = tf.histogram_fixed_width(self.G, value_range, nbins=nbins, dtype=tf.float32) / nbins - hist_images = tf.histogram_fixed_width(self.images, value_range, nbins=nbins, dtype=tf.float32) / nbins + hist_g = tf.to_float(tf.histogram_fixed_width(self.G, value_range, nbins=nbins)) / nbins + hist_images = tf.to_float(tf.histogram_fixed_width(self.images, value_range, nbins=nbins)) / nbins chi_square = tf.reduce_mean(tf.div(tf.square(hist_g - hist_images), hist_g + hist_images + 1e-5)) self.summaries.append(scalar_summary("chi_square", chi_square)) else: diff --git a/examples/gan/network-mnist.py b/examples/gan/network-mnist.py index 63d1d9bb7..37f1163d3 100644 --- a/examples/gan/network-mnist.py +++ b/examples/gan/network-mnist.py @@ -366,8 +366,8 @@ def build_model(self): # Extra hook for debug: log chi-square distance between G's output histogram and the dataset's histogram value_range = [0.0, 1.0] nbins = 100 - hist_g = tf.histogram_fixed_width(self.G, value_range, nbins=nbins, dtype=tf.float32) / nbins - hist_images = tf.histogram_fixed_width(self.images, value_range, nbins=nbins, dtype=tf.float32) / nbins + hist_g = tf.to_float(tf.histogram_fixed_width(self.G, value_range, nbins=nbins)) / nbins + hist_images = tf.to_float(tf.histogram_fixed_width(self.images, value_range, nbins=nbins)) / nbins chi_square = tf.reduce_mean(tf.div(tf.square(hist_g - hist_images), hist_g + hist_images + 1e-5)) self.summaries.append(scalar_summary("chi_square", chi_square)) else: