Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wgan_gp.py #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion wgan_gp/wgan_gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from __future__ import print_function, division

from keras.datasets import mnist
from keras.layers.merge import _Merge
from keras.layers.merge import _Merge # this don't work with tensorflow 2.7 or keras 2.9
# from tensorflow.keras.layers.merging.base_merge import _Merge # tensorflow 2.9
# from keras.layers.merge import _Merge # tensorflow 2.7
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import LeakyReLU
Expand All @@ -23,6 +25,10 @@

import numpy as np

# running tf 2.7/2.9, to avoid error, disable eager execution
# from tensorflow.python.framework.ops import disable_eager_execution
# disable_eager_execution()

class RandomWeightedAverage(_Merge):
"""Provides a (random) weighted average between real and generated image samples"""
def _merge_function(self, inputs):
Expand Down