def sg_vgg_19(tensor, opt):
    r"""Applies vgg 19 model.
    
    Note that the fc layers in the original architecture 
      will be replaced with fully convolutional layers.
      For convenience, We still call them fc layers, though.
    
    Args:
      tensor: A `Tensor`.
      opt:
        num_class: An integer. Number of class. Default is 1000.
        conv_only: Boolean. If True, fc layers are not applied. Default is False.
        squeeze: Boolean. If True (default), the dimensions with size 1 in the final outputs will be removed.
        act: String. 'relu' (default). the activation function name
        bn: True or False(default). If True, batch normal will be applied
        reuse: Boolean(Optional). If True, all variables will be loaded from previous network.
        name: String(Optional). If provided, used as the scope name of this network
    
    Returns:
      A `Tensor`.
    """
    opt += tf.sg_opt(num_class=1000, conv_only=False, squeeze=True, act='relu')

    # convolution layers
    with tf.sg_context(name=opt.name, act=opt.act, bn=opt.bn, reuse=opt.reuse):
        conv = (tensor
                .sg_conv(dim=64, name='conv1_1')
                .sg_conv(name='conv1_2')
                .sg_pool()
                .sg_conv(dim=128, name='conv2_1')
                .sg_conv(name='conv2_2')
                .sg_pool()
                .sg_conv(dim=256, name='conv3_1')
                .sg_conv(name='conv3_2')
                .sg_conv(name='conv3_3')
                .sg_conv(name='conv3_4')
                .sg_pool()
                .sg_conv(dim=512, name='conv4_1')
                .sg_conv(name='conv4_2')
                .sg_conv(name='conv4_3')
                .sg_conv(name='conv4_4')
                .sg_pool()
                .sg_conv(dim=512, name='conv5_1')
                .sg_conv(name='conv5_2')
                .sg_conv(name='conv5_3')
                .sg_conv(name='conv5_4')
                .sg_pool())

    # fully convolution layers
    with tf.sg_context(name=opt.name, act=opt.act, pad='VALID', bn=opt.bn, reuse=opt.reuse):
        fc = (conv
              .sg_conv(dim=4096, size=7, dout=opt.dout, name='fc1')
              .sg_conv(dim=4096, size=1, dout=opt.dout, name='fc2')
              .sg_conv(dim=opt.num_class, size=1, act='linear', name='fc3'))

    if opt.conv_only:
        return conv
    else:
        if opt.squeeze:
            return fc.sg_squeeze(axis=(1, 2))
        else:
            return fc
def sg_vgg_19 ( tensor , opt ) : opt += tf . sg_opt ( num_class = 1000 , conv_only = False , squeeze = True , act = 'relu' ) with tf . sg_context ( name = opt . name , act = opt . act , bn = opt . bn , reuse = opt . reuse ) : conv = ( tensor . sg_conv ( dim = 64 , name = 'conv1_1' ) . sg_conv ( name = 'conv1_2' ) . sg_pool ( ) . sg_conv ( dim = 128 , name = 'conv2_1' ) . sg_conv ( name = 'conv2_2' ) . sg_pool ( ) . sg_conv ( dim = 256 , name = 'conv3_1' ) . sg_conv ( name = 'conv3_2' ) . sg_conv ( name = 'conv3_3' ) . sg_conv ( name = 'conv3_4' ) . sg_pool ( ) . sg_conv ( dim = 512 , name = 'conv4_1' ) . sg_conv ( name = 'conv4_2' ) . sg_conv ( name = 'conv4_3' ) . sg_conv ( name = 'conv4_4' ) . sg_pool ( ) . sg_conv ( dim = 512 , name = 'conv5_1' ) . sg_conv ( name = 'conv5_2' ) . sg_conv ( name = 'conv5_3' ) . sg_conv ( name = 'conv5_4' ) . sg_pool ( ) ) with tf . sg_context ( name = opt . name , act = opt . act , pad = 'VALID' , bn = opt . bn , reuse = opt . reuse ) : fc = ( conv . sg_conv ( dim = 4096 , size = 7 , dout = opt . dout , name = 'fc1' ) . sg_conv ( dim = 4096 , size = 1 , dout = opt . dout , name = 'fc2' ) . sg_conv ( dim = opt . num_class , size = 1 , act = 'linear' , name = 'fc3' ) ) if opt . conv_only : return conv else : if opt . squeeze : return fc . sg_squeeze ( axis = ( 1 , 2 ) ) else : return fc
r"""Applies vgg 19 model.
    
    Note that the fc layers in the original architecture 
      will be replaced with fully convolutional layers.
      For convenience, We still call them fc layers, though.
    
    Args:
      tensor: A `Tensor`.
      opt:
        num_class: An integer. Number of class. Default is 1000.
        conv_only: Boolean. If True, fc layers are not applied. Default is False.
        squeeze: Boolean. If True (default), the dimensions with size 1 in the final outputs will be removed.
        act: String. 'relu' (default). the activation function name
        bn: True or False(default). If True, batch normal will be applied
        reuse: Boolean(Optional). If True, all variables will be loaded from previous network.
        name: String(Optional). If provided, used as the scope name of this network
    
    Returns:
      A `Tensor`.