<filename>discriminator.py
import tensorflow.compat.v1 as tf
import ops


class Discriminator:
    def __init__(self, name, is_training, norm='instance', use_sigmoid=False):
        self.name = name
        self.is_training = is_training
        self.norm = norm
        self.reuse = False
        self.use_sigmoid = use_sigmoid

    def __call__(self, input):
        """
    Args:
      input: batch_size x image_size x image_size x 3
    Returns:
      output: 4D tensor batch_size x out_size x out_size x 1 (default 1x5x5x1)
              filled with 0.9 if real, 0.0 if fake
    """
        with tf.variable_scope(self.name):
            # convolution layers
            C64 = ops.Ck(input, 64, reuse=self.reuse, norm=None, is_training=self.is_training,
                         name='C64')  # (1, 160, 144, 64)
            C128 = ops.Ck(C64, 128, reuse=self.reuse, norm=self.norm, is_training=self.is_training,
                          name='C128')  # (1, 80, 72, 128)
            C256 = ops.Ck(C128, 256, reuse=self.reuse, norm=self.norm, is_training=self.is_training,
                          name='C256')  # (1, 40, 36, 256)
            C512 = ops.Ck(C256, 512, reuse=self.reuse, norm=self.norm, is_training=self.is_training,
                          name='C512')  # (1, 20, 18, 512)

            output = ops.last_conv(C512, reuse=self.reuse, use_sigmoid=self.use_sigmoid,
                                   name='output')  # (1, 20, 18, 1)
            print(output.shape)
        self.reuse = True
        self.variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=self.name)

        return output

<filename>discriminator.py
import tensorflow.compat.v1 as tf
import ops


class Discriminator:
    def __init__(self, name, is_training, norm='instance', use_sigmoid=False):
        self.name = name
        self.is_training = is_training
        self.norm = norm
        self.reuse = False
        self.use_sigmoid = use_sigmoid

    def __call__(self, input):
        """
    Args:
      input: batch_size x image_size x image_size x 3
    Returns:
      output: 4D tensor batch_size x out_size x out_size x 1 (default 1x5x5x1)
              filled with 0.9 if real, 0.0 if fake
    """
        with tf.variable_scope(self.name):
            # convolution layers
            C64 = ops.Ck(input, 64, reuse=self.reuse, norm=None, is_training=self.is_training,
                         name='C64')  # (1, 160, 144, 64)
            C128 = ops.Ck(C64, 128, reuse=self.reuse, norm=self.norm, is_training=self.is_training,
                          name='C128')  # (1, 80, 72, 128)
            C256 = ops.Ck(C128, 256, reuse=self.reuse, norm=self.norm, is_training=self.is_training,
                          name='C256')  # (1, 40, 36, 256)
            C512 = ops.Ck(C256, 512, reuse=self.reuse, norm=self.norm, is_training=self.is_training,
                          name='C512')  # (1, 20, 18, 512)

            output = ops.last_conv(C512, reuse=self.reuse, use_sigmoid=self.use_sigmoid,
                                   name='output')  # (1, 20, 18, 1)
            print(output.shape)
        self.reuse = True
        self.variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=self.name)

        return output

Args:       input: batch_size x image_size x image_size x 3     Returns:       output: 4D tensor batch_size x out_size x out_size x 1 (default 1x5x5x1)               filled with 0.9 if real, 0.0 if fake # convolution layers # (1, 160, 144, 64) # (1, 80, 72, 128) # (1, 40, 36, 256) # (1, 20, 18, 512) # (1, 20, 18, 1)