a e@sRddlZddlmZddlmZmZmZddlmZeGdddej Z dS)N)nn)ResidualBlockNoBNUpsample make_layer) ARCH_REGISTRYcs*eZdZdZd fdd Zd d ZZS) EDSRa4EDSR network structure. Paper: Enhanced Deep Residual Networks for Single Image Super-Resolution. Ref git repo: https://github.com/thstkdgus35/EDSR-PyTorch Args: num_in_ch (int): Channel number of inputs. num_out_ch (int): Channel number of outputs. num_feat (int): Channel number of intermediate features. Default: 64. num_block (int): Block number in the trunk network. Default: 16. upscale (int): Upsampling factor. Support 2^n and 3. Default: 4. res_scale (float): Used to scale the residual in residual block. Default: 1. img_range (float): Image range. Default: 255. rgb_mean (tuple[float]): Image mean in RGB orders. Default: (0.4488, 0.4371, 0.4040), calculated from DIV2K dataset. @o@gw#?g8EGr?gB`"?c stt|||_t|dddd|_t ||ddd|_ t t |||dd|_ t ||ddd|_t|||_t ||ddd|_dS)Nr T)num_feat res_scale pytorch_init)superr__init__ img_rangetorchTensorviewmeanrConv2d conv_firstrrbodyconv_after_bodyrupsample conv_last) self num_in_ch num_out_chr num_blockupscalerrZrgb_mean __class__'D:\face swap\basicsr\archs\edsr_arch.pyrs  z EDSR.__init__cCsd|j||_||j|j}||}|||}||7}|||}||j|j}|S)N)rtype_asrrrrrr)rxresr&r&r'forward2s z EDSR.forward)rr r r r r )__name__ __module__ __qualname____doc__rr+ __classcell__r&r&r$r'rsr) rrbasicsr.archs.arch_utilrrrbasicsr.utils.registryrregisterModulerr&r&r&r's