original_docstring: Discriminator network for DCGAN.
  
    Construct discriminator network from inputs to the final endpoint.
  
    Args:
      inputs: A tensor of size [batch_size, height, width, channels]. Must be
        floating point.
      depth: Number of channels in first convolution layer.
      is_training: Whether the network is for training or not.
      reuse: Whether or not the network variables should be reused. `scope`
        must be given to be reused.
      scope: Optional variable_scope.
      fused_batch_norm: If `True`, use a faster, fused implementation of
        batch norm.
  
    Returns:
      logits: The pre-softmax activations, a tensor of size [batch_size, 1]
      end_points: a dictionary from components of the network to their activation.
  
    Raises:
      ValueError: If the input image shape is not 4-dimensional, if the spatial
        dimensions aren't defined at graph construction time, if the spatial
        dimensions aren't square, or if the spatial dimensions aren't a power of
        two.
    
docstring: Discriminator network for DCGAN.
  Construct discriminator network from inputs to the final endpoint.
docstring_tokens: Discriminator network for DCGAN . Construct discriminator network from inputs to the final endpoint .
code: def discriminator(inputs,
                    depth=64,
                    is_training=True,
                    reuse=None,
                    scope='Discriminator',
                    fused_batch_norm=False):
    """Discriminator network for DCGAN.
  
    Construct discriminator network from inputs to the final endpoint.
  
    Args:
      inputs: A tensor of size [batch_size, height, width, channels]. Must be
        floating point.
      depth: Number of channels in first convolution layer.
      is_training: Whether the network is for training or not.
      reuse: Whether or not the network variables should be reused. `scope`
        must be given to be reused.
      scope: Optional variable_scope.
      fused_batch_norm: If `True`, use a faster, fused implementation of
        batch norm.
  
    Returns:
      logits: The pre-softmax activations, a tensor of size [batch_size, 1]
      end_points: a dictionary from components of the network to their activation.
  
    Raises:
      ValueError: If the input image shape is not 4-dimensional, if the spatial
        dimensions aren't defined at graph construction time, if the spatial
        dimensions aren't square, or if the spatial dimensions aren't a power of
        two.
    """
  
    normalizer_fn = slim.batch_norm
    normalizer_fn_args = {
        'is_training': is_training,
        'zero_debias_moving_mean': True,
        'fused': fused_batch_norm,
    }
  
    _validate_image_inputs(inputs)
    inp_shape = inputs.get_shape().as_list()[1]
  
    end_points = {}
    with tf.variable_scope(
        scope, values=[inputs], reuse=reuse) as scope:
      with slim.arg_scope([normalizer_fn], **normalizer_fn_args):
        with slim.arg_scope([slim.conv2d],
                            stride=2,
                            kernel_size=4,
                            activation_fn=tf.nn.leaky_relu):
          net = inputs
          for i in xrange(int(log(inp_shape, 2))):
            scope = 'conv%i' % (i + 1)
            current_depth = depth * 2**i
            normalizer_fn_ = None if i == 0 else normalizer_fn
            net = slim.conv2d(
                net, current_depth, normalizer_fn=normalizer_fn_, scope=scope)
            end_points[scope] = net
  
          logits = slim.conv2d(net, 1, kernel_size=1, stride=1, padding='VALID',
                               normalizer_fn=None, activation_fn=None)
          logits = tf.reshape(logits, [-1, 1])
          end_points['logits'] = logits
  
          return logits, end_points
code_tokens: def discriminator ( inputs , depth = 64 , is_training = True , reuse = None , scope = 'Discriminator' , fused_batch_norm = False ) : normalizer_fn = slim . batch_norm normalizer_fn_args = { 'is_training' : is_training , 'zero_debias_moving_mean' : True , 'fused' : fused_batch_norm , } _validate_image_inputs ( inputs ) inp_shape = inputs . get_shape ( ) . as_list ( ) [ 1 ] end_points = { } with tf . variable_scope ( scope , values = [ inputs ] , reuse = reuse ) as scope : with slim . arg_scope ( [ normalizer_fn ] , ** normalizer_fn_args ) : with slim . arg_scope ( [ slim . conv2d ] , stride = 2 , kernel_size = 4 , activation_fn = tf . nn . leaky_relu ) : net = inputs for i in xrange ( int ( log ( inp_shape , 2 ) ) ) : scope = 'conv%i' % ( i + 1 ) current_depth = depth * 2 ** i normalizer_fn_ = None if i == 0 else normalizer_fn net = slim . conv2d ( net , current_depth , normalizer_fn = normalizer_fn_ , scope = scope ) end_points [ scope ] = net logits = slim . conv2d ( net , 1 , kernel_size = 1 , stride = 1 , padding = 'VALID' , normalizer_fn = None , activation_fn = None ) logits = tf . reshape ( logits , [ - 1 , 1 ] ) end_points [ 'logits' ] = logits return logits , end_points
short_docstring: Discriminator network for DCGAN.
short_docstring_tokens: Discriminator network for DCGAN .
comment: """Discriminator network for DCGAN.
  
    Construct discriminator network from inputs to the final endpoint.
  
    Args:
      inputs: A tensor of size [batch_size, height, width, channels]. Must be
        floating point.
      depth: Number of channels in first convolution layer.
      is_training: Whether the network is for training or not.
      reuse: Whether or not the network variables should be reused. `scope`
        must be given to be reused.
      scope: Optional variable_scope.
      fused_batch_norm: If `True`, use a faster, fused implementation of
        batch norm.
  
    Returns:
      logits: The pre-softmax activations, a tensor of size [batch_size, 1]
      end_points: a dictionary from components of the network to their activation.
  
    Raises:
      ValueError: If the input image shape is not 4-dimensional, if the spatial
        dimensions aren't defined at graph construction time, if the spatial
        dimensions aren't square, or if the spatial dimensions aren't a power of
        two.
    """