Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, opts, data, weights):
# One more placeholder for batch norm
self._is_training_ph = None
Pot.__init__(self, opts, data, weights)
# subtract trigger amount from other active action
for o in active:
seat = o.hand.seat
self.pots[-1].players.append(o)
self.pots[-1].value += amt
action[seat] -= amt
# Add leftovers to the first pot
for amt in action:
self.pots[0].value += amt
self.pots.reverse()
else:
self.pots.append(Pot())
self.pots[0].value = self.pot
self.pots[0].players = self.activeplayers()
"""Build a TensorFlow graph with all the necessary ops.
"""
assert False, 'POT base class has no build_model method defined.'
def _train_internal(self, opts):
assert False, 'POT base class has no train method defined.'
def _sample_internal(self, opts, num):
assert False, 'POT base class has no sample method defined.'
def _train_mixture_discriminator_internal(self, opts, fake_images):
assert False, 'POT base class has no mixture discriminator method defined.'
class ImagePot(Pot):
"""A simple POT implementation, suitable for pictures.
"""
def __init__(self, opts, data, weights):
# One more placeholder for batch norm
self._is_training_ph = None
Pot.__init__(self, opts, data, weights)
def dcgan_like_arch(self, opts, noise, is_training, reuse, keep_prob):
output_shape = self._data.data_shape
num_units = opts['g_num_filters']
batch_size = tf.shape(noise)[0]
for seat in xrange(len(self.players)):
action.append(self.players[seat].inplay)
active = self.activeplayers()
active.sort(Player.actionsort)
while len(active):
p = active.pop(0)
seat = p.hand.seat
if action[seat]:
# get trigger amount
amt = action[seat]
# add a new pot, setting the trigger
self.pots.append(Pot(amt))
# add current player to pot
self.pots[-1].players.append(p)
# add trigger amount to pot
self.pots[-1].value += amt
# subtract trigger amount from trigger's action
action[seat] -= amt
# subtract trigger amount from other active action
for o in active:
seat = o.hand.seat
self.pots[-1].players.append(o)
self.pots[-1].value += amt
action[seat] -= amt
for seat in xrange(len(self.players)):
action.append(self.players[seat].inplay)
active = self.activeplayers()
active.sort(Player.actionsort)
while len(active):
p = active.pop(0)
seat = p.hand.seat
if action[seat]:
# get trigger amount
amt = action[seat]
# add a new pot, setting the trigger
self.pots.append(Pot(amt))
# add current player to pot
self.pots[-1].players.append(p)
# add trigger amount to pot
self.pots[-1].value += amt
# subtract trigger amount from trigger's action
action[seat] -= amt
# subtract trigger amount from other active action
for o in active:
seat = o.hand.seat
self.pots[-1].players.append(o)
self.pots[-1].value += amt
action[seat] -= amt
# subtract trigger amount from other active action
for o in active:
seat = o.hand.seat
self.pots[-1].players.append(o)
self.pots[-1].value += amt
action[seat] -= amt
# Add leftovers to the first pot
for amt in action:
self.pots[0].value += amt
self.pots.reverse()
else:
self.pots.append(Pot())
self.pots[0].value = self.pot
self.pots[0].players = self.activeplayers()
if opts['dataset'] in ('gmm', 'circle_gmm'):
if opts['unrolled'] is True:
gan_class = GAN.ToyUnrolledGan
else:
gan_class = GAN.ToyGan
elif opts['dataset'] in pic_datasets:
if opts['unrolled']:
gan_class = GAN.ImageUnrolledGan
# gan_class = GAN.ToyUnrolledGan
else:
if 'vae' in opts and opts['vae']:
gan_class = VAE.ImageVae
assert opts['latent_space_distr'] == 'normal',\
'VAE works only with Gaussian prior'
elif 'pot' in opts and opts['pot']:
gan_class = POT.ImagePot
else:
gan_class = GAN.ImageGan
if opts['dataset'] in supervised_pic_datasets\
and 'conditional' in opts and opts['conditional']:
gan_class = GAN.MNISTLabelGan
elif opts['dataset'] == 'guitars':
if opts['unrolled']:
gan_class = GAN.ImageUnrolledGan
else:
gan_class = GAN.BigImageGan
else:
assert False, "We don't have any other GAN implementations yet..."
self._gan_class = gan_class
if opts["inverse_metric"]:
inv_num = opts['inverse_num']
assert inv_num < data.num_points, \