Skip to content

Commit

Permalink
Merge pull request #2014 from IsaacYangSLA/fix/TF_API
Browse files Browse the repository at this point in the history
Update for new TF API
  • Loading branch information
IsaacYangSLA authored Apr 5, 2018
2 parents 85e4d64 + 61224fa commit 7a3d5f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/gan/network-celebA.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions examples/gan/network-mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7a3d5f0

Please sign in to comment.