8gddlmZddlZddlZddlmZddlmZddlZ e dZ ddlmZddl mcm ZGddejZGddejZy) )deepcopyN)versioninfc(eZdZ dfd ZdZxZS) ConvBnReLUctt| tj|||||d|_tj d|_y)NF)stridepaddingbiasT)inplace)superr__init__nnConv2dconvReLUrelu)self in_channels out_channels kernel_sizer pad __class__s 1/nas3/zsz/FLARE_huggingface/mast3r/shallow_cnn.pyrzConvBnReLU.__init__s> j$(*IIk<)&#ES GGD) cB|j|j|SN)rr)rxs rforwardzConvBnReLU.forwardsyy1&&r)r!)__name__ __module__ __qualname__rr __classcell__rs@rrrs./* 'rrcBeZdZejffd ZdZdZxZS) FeatureNetc tt| tjt dddddt ddddd|_tjt dddddt ddddd|_tjt dddddt ddddd|_tjddd|_ tjddd|_ tjddd|_ tjdddd|_ tjdddd|_y) Nr r! )r )r r(rr Sequentialrconv0conv1conv2rtoplayerlat1lat0smooth1smooth0)rnorm_actrs rrzFeatureNet.__init__s j$(*]]"1aAq1"1aAq13 ]]"1b!Q2"2r1a35 ]]"2r1a3"2r1a35  "b!, IIb"a( IIaQ' yyRA6 yyRA6 rc:tj|ddd|zS)Nr-bilinearT) scale_factormode align_corners)F interpolate)rrys r _upsample_addzFeatureNet._upsample_add/s}}QQZtTWXXXrc\|j|}|j|}|j|}|j|}|j ||j |}|j ||j |}|j|}|j|}|||fSr) r0r1r2r3rAr4r5r6r7)rrr0r1r2feat2feat1feat0s rrzFeatureNet.forward2s 1  5! 5! e$""5$))E*:;""5$))E*:; U# U#eU""r) r"r#r$r BatchNorm2drrArr%r&s@rr(r(s "7&Y #rr()copyrtorchos packagingrtorch.nnrdust3r.utils.path_to_crocodust3rfloatrtorch.nn.functional functionalr>Modulerr(rrrSsK ! El'' # #r