(self, inputs, in_channels, out_channels, scale, suffix,
                kernel_size=(3, 3), strides=(1, 1))
return outputs
Performs a convolution in the ResNet block.
Performs a convolution in the ResNet block.
Performs a convolution in the ResNet block .
def _get_conv(self, inputs, in_channels, out_channels, scale, suffix,
                kernel_size=(3, 3), strides=(1, 1)):
    """Performs a convolution in the ResNet block."""
    if inputs.get_shape().as_list()[-1] != in_channels:
      raise ValueError("Unexpected number of input channels.")
    if scale not in ["up", "down", "none"]:
      raise ValueError(
          "Scale: got {}, expected 'up', 'down', or 'none'.".format(scale))

    outputs = inputs
    if scale == "up":
      outputs = unpool(outputs)
    outputs = ops.conv2d(
        outputs,
        output_dim=out_channels,
        k_h=kernel_size[0], k_w=kernel_size[1],
        d_h=strides[0], d_w=strides[1],
        use_sn=self._spectral_norm,
        name="{}_{}".format("same" if scale == "none" else scale, suffix))
    if scale == "down":
      outputs = tf.nn.pool(outputs, [2, 2], "AVG", "SAME", strides=[2, 2],
                           name="pool_%s" % suffix)
    return outputs
def _get_conv ( self , inputs , in_channels , out_channels , scale , suffix , kernel_size = ( 3 , 3 ) , strides = ( 1 , 1 ) ) : if inputs . get_shape ( ) . as_list ( ) [ - 1 ] != in_channels : raise ValueError ( "Unexpected number of input channels." ) if scale not in [ "up" , "down" , "none" ] : raise ValueError ( "Scale: got {}, expected 'up', 'down', or 'none'." . format ( scale ) ) outputs = inputs if scale == "up" : outputs = unpool ( outputs ) outputs = ops . conv2d ( outputs , output_dim = out_channels , k_h = kernel_size [ 0 ] , k_w = kernel_size [ 1 ] , d_h = strides [ 0 ] , d_w = strides [ 1 ] , use_sn = self . _spectral_norm , name = "{}_{}" . format ( "same" if scale == "none" else scale , suffix ) ) if scale == "down" : outputs = tf . nn . pool ( outputs , [ 2 , 2 ] , "AVG" , "SAME" , strides = [ 2 , 2 ] , name = "pool_%s" % suffix ) return outputs