original_docstring: Adds a 2D convolution.
  
    conv2d creates a variable called 'weights', representing the convolutional
    kernel, that is convolved with the input.
  
    Args:
      inputs: a 4D tensor in NHWC format.
      num_filters_out: the number of output filters.
      kernel_size: an int specifying the kernel height and width size.
      stride: an int specifying the height and width stride.
      scope: Optional scope for variable_scope.
      reuse: whether or not the layer and its variables should be reused.
    Returns:
      a tensor that is the result of a convolution being applied to `inputs`.
    
docstring: Adds a 2D convolution.
  conv2d creates a variable called 'weights', representing the convolutional
  kernel, that is convolved with the input.
docstring_tokens: Adds a 2D convolution . conv2d creates a variable called ' weights ' representing the convolutional kernel that is convolved with the input .
code: def conv2d(inputs,
             num_filters_out,
             kernel_size,
             stride=1,
             scope=None,
             reuse=None):
    """Adds a 2D convolution.
  
    conv2d creates a variable called 'weights', representing the convolutional
    kernel, that is convolved with the input.
  
    Args:
      inputs: a 4D tensor in NHWC format.
      num_filters_out: the number of output filters.
      kernel_size: an int specifying the kernel height and width size.
      stride: an int specifying the height and width stride.
      scope: Optional scope for variable_scope.
      reuse: whether or not the layer and its variables should be reused.
    Returns:
      a tensor that is the result of a convolution being applied to `inputs`.
    """
    with tf.variable_scope(scope, 'Conv', [inputs], reuse=reuse):
      num_filters_in = int(inputs.shape[3])
      weights_shape = [kernel_size, kernel_size, num_filters_in, num_filters_out]
  
      # Initialization
      n = int(weights_shape[0] * weights_shape[1] * weights_shape[3])
      weights_initializer = tf.random_normal_initializer(
          stddev=np.sqrt(2.0 / n))
  
      weights = variable(
          name='weights',
          shape=weights_shape,
          dtype=tf.float32,
          initializer=weights_initializer,
          trainable=True)
      strides = stride_arr(stride, stride)
      outputs = tf.nn.conv2d(
          inputs, weights, strides, padding='SAME', data_format='NHWC')
      return outputs
code_tokens: def conv2d ( inputs , num_filters_out , kernel_size , stride = 1 , scope = None , reuse = None ) : with tf . variable_scope ( scope , 'Conv' , [ inputs ] , reuse = reuse ) : num_filters_in = int ( inputs . shape [ 3 ] ) weights_shape = [ kernel_size , kernel_size , num_filters_in , num_filters_out ] n = int ( weights_shape [ 0 ] * weights_shape [ 1 ] * weights_shape [ 3 ] ) weights_initializer = tf . random_normal_initializer ( stddev = np . sqrt ( 2.0 / n ) ) weights = variable ( name = 'weights' , shape = weights_shape , dtype = tf . float32 , initializer = weights_initializer , trainable = True ) strides = stride_arr ( stride , stride ) outputs = tf . nn . conv2d ( inputs , weights , strides , padding = 'SAME' , data_format = 'NHWC' ) return outputs
short_docstring: Adds a 2D convolution.
short_docstring_tokens: Adds a 2D convolution .
comment: """Adds a 2D convolution.
  
    conv2d creates a variable called 'weights', representing the convolutional
    kernel, that is convolved with the input.
  
    Args:
      inputs: a 4D tensor in NHWC format.
      num_filters_out: the number of output filters.
      kernel_size: an int specifying the kernel height and width size.
      stride: an int specifying the height and width stride.
      scope: Optional scope for variable_scope.
      reuse: whether or not the layer and its variables should be reused.
    Returns:
      a tensor that is the result of a convolution being applied to `inputs`.
    """$SEP$# Initialization