Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

import tensorflow as tf 

import numpy as np 

import hyperchamber as hc 

from hypergan.generators.common import * 

 

from .base_generator import BaseGenerator 

 

class DCGANGenerator(BaseGenerator): 

 

def required(self): 

return [] 

 

def build(self, net): 

gan = self.gan 

ops = self.ops 

config = self.config 

activation = ops.lookup(config.activation or 'lrelu') 

 

print("[dcgan] NET IS", net) 

 

net = ops.linear(net, 4*4*1024) 

 

shape = ops.shape(net) 

 

net = ops.reshape(net, [shape[0],4,4,1024]) 

 

net = activation(net) 

net = ops.deconv2d(net, 5, 5, 2, 2, 512) 

net = self.layer_filter(net) 

net = self.layer_regularizer(net) 

net = activation(net) 

net = ops.deconv2d(net, 5, 5, 2, 2, 256) 

net = self.layer_regularizer(net) 

net = activation(net) 

net = self.layer_filter(net) 

net = ops.deconv2d(net, 5, 5, 2, 2, 128) 

net = self.layer_regularizer(net) 

net = activation(net) 

net = self.layer_filter(net) 

net = ops.deconv2d(net, 5, 5, 2, 2, gan.channels()) 

net = self.layer_regularizer(net) 

net = ops.lookup('tanh')(net) 

 

self.sample = net 

return self.sample