docs: def sg_resnet_layer(x, opt):
      r"""Applies basic architecture of residual net.
      
      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:
        x: A `Tensor`.
        opt:
            dim: An integer. Dimension for this resnet layer
            num: Number of times to repeat
            act: String. 'relu' (default). the activation function name
            reuse: Boolean(Optional). If True, all variables will be loaded from previous network.
            name: String. (optional) Used as convolution layer prefix
  
      Returns:
        A `Tensor`. 
      """
      assert opt.dim is not None, 'dim is mandatory.'
      assert opt.num is not None, 'num is mandatory.'
  
      # default stride
      opt += tf.sg_opt(stride=1, act='relu')
  
      # format convolutional layer name
      def cname(index):
          return opt.name if opt.name is None else opt.name + '_%d' % index
  
      with tf.sg_context(bias=False, reuse=opt.reuse):
          # 1st block
          out = (x
                 .sg_bypass(act=opt.act, bn=True, name=cname(0))
                 .sg_conv(dim=opt.dim, size=1, act=opt.act, stride=opt.stride, bn=True, name=cname(1))
                 .sg_conv(dim=opt.dim, size=3, act=opt.act, bn=True, name=cname(2))
                 .sg_conv(dim=opt.dim*4, size=1, name=cname(3)))
          out += x.sg_conv(dim=opt.dim * 4, size=1, stride=opt.stride, name=cname(4))
  
          # middle blocks
          for i in range(1, opt.num):
              out_new = (out
                         .sg_bypass(act=opt.act, name=cname(4 * i + 1))
                         .sg_conv(dim=opt.dim, size=1, act=opt.act, bn=True, name=cname(4 * i + 2))
                         .sg_conv(dim=opt.dim, size=3, act=opt.act, bn=True, name=cname(4 * i + 3))
                         .sg_conv(dim=opt.dim*4, size=1, name=cname(4 * i + 4)))
              out += out_new
  
      return out