(x,
                      depth,
                      stride,
                      weight_decay,
                      params=None,
                      moments=None,
                      use_project=False,
                      backprop_through_moments=True,
                      is_training=True,
                      use_bounded_activation=False)
return out, params, moments
Wide ResNet residual block.
Wide ResNet residual block.
Wide ResNet residual block .
def wide_resnet_block(x,
                      depth,
                      stride,
                      weight_decay,
                      params=None,
                      moments=None,
                      use_project=False,
                      backprop_through_moments=True,
                      is_training=True,
                      use_bounded_activation=False):
  """Wide ResNet residual block."""
  params_keys, params_vars = [], []
  moments_keys, moments_vars = [], []
  with tf.variable_scope('conv1'):
    bn_1, bn_params, bn_moments = bn(
        x,
        params=params,
        moments=moments,
        is_training=is_training,
        backprop_through_moments=backprop_through_moments)
    params_keys.extend(bn_params.keys())
    params_vars.extend(bn_params.values())
    moments_keys.extend(bn_moments.keys())
    moments_vars.extend(bn_moments.values())

    out_1 = relu(bn_1, use_bounded_activation=use_bounded_activation)

    h_1, conv_params = conv(
        out_1, [3, 3], depth, stride, weight_decay, params=params)
    params_keys.extend(conv_params.keys())
    params_vars.extend(conv_params.values())
  with tf.variable_scope('conv2'):
    bn_2, bn_params, bn_moments = bn(
        h_1,
        params=params,
        moments=moments,
        is_training=is_training,
        backprop_through_moments=backprop_through_moments)
    params_keys.extend(bn_params.keys())
    params_vars.extend(bn_params.values())
    moments_keys.extend(bn_moments.keys())
    moments_vars.extend(bn_moments.values())

    out_2 = relu(bn_2, use_bounded_activation=use_bounded_activation)

    h_2, conv_params = conv(
        out_2, [3, 3],
        depth,
        stride=1,
        weight_decay=weight_decay,
        params=params)
    params_keys.extend(conv_params.keys())
    params_vars.extend(conv_params.values())

  h = h_2
  if use_bounded_activation:
    h = tf.clip_by_value(h, -6, 6)

  with tf.variable_scope('identity'):
    if use_project:
      with tf.variable_scope('projection_conv'):
        x, conv_params = conv(
            out_1, [1, 1], depth, stride, weight_decay, params=params)
        params_keys.extend(conv_params.keys())
        params_vars.extend(conv_params.values())

  params = collections.OrderedDict(zip(params_keys, params_vars))
  moments = collections.OrderedDict(zip(moments_keys, moments_vars))

  if use_bounded_activation:
    out = tf.clip_by_value(x + h, -6, 6)
  else:
    out = x + h
  return out, params, moments
def wide_resnet_block ( x , depth , stride , weight_decay , params = None , moments = None , use_project = False , backprop_through_moments = True , is_training = True , use_bounded_activation = False ) : params_keys , params_vars = [ ] , [ ] moments_keys , moments_vars = [ ] , [ ] with tf . variable_scope ( 'conv1' ) : bn_1 , bn_params , bn_moments = bn ( x , params = params , moments = moments , is_training = is_training , backprop_through_moments = backprop_through_moments ) params_keys . extend ( bn_params . keys ( ) ) params_vars . extend ( bn_params . values ( ) ) moments_keys . extend ( bn_moments . keys ( ) ) moments_vars . extend ( bn_moments . values ( ) ) out_1 = relu ( bn_1 , use_bounded_activation = use_bounded_activation ) h_1 , conv_params = conv ( out_1 , [ 3 , 3 ] , depth , stride , weight_decay , params = params ) params_keys . extend ( conv_params . keys ( ) ) params_vars . extend ( conv_params . values ( ) ) with tf . variable_scope ( 'conv2' ) : bn_2 , bn_params , bn_moments = bn ( h_1 , params = params , moments = moments , is_training = is_training , backprop_through_moments = backprop_through_moments ) params_keys . extend ( bn_params . keys ( ) ) params_vars . extend ( bn_params . values ( ) ) moments_keys . extend ( bn_moments . keys ( ) ) moments_vars . extend ( bn_moments . values ( ) ) out_2 = relu ( bn_2 , use_bounded_activation = use_bounded_activation ) h_2 , conv_params = conv ( out_2 , [ 3 , 3 ] , depth , stride = 1 , weight_decay = weight_decay , params = params ) params_keys . extend ( conv_params . keys ( ) ) params_vars . extend ( conv_params . values ( ) ) h = h_2 if use_bounded_activation : h = tf . clip_by_value ( h , - 6 , 6 ) with tf . variable_scope ( 'identity' ) : if use_project : with tf . variable_scope ( 'projection_conv' ) : x , conv_params = conv ( out_1 , [ 1 , 1 ] , depth , stride , weight_decay , params = params ) params_keys . extend ( conv_params . keys ( ) ) params_vars . extend ( conv_params . values ( ) ) params = collections . OrderedDict ( zip ( params_keys , params_vars ) ) moments = collections . OrderedDict ( zip ( moments_keys , moments_vars ) ) if use_bounded_activation : out = tf . clip_by_value ( x + h , - 6 , 6 ) else : out = x + h return out , params , moments