20200919_0840281148×896 77.9 KB
20200919_084106593×852 64.4 KB
def forward( self, x ):
start = time.time()
out = self.Rconv2d( x )
cost = time.time()-start
out = self.maxpool1( out )
out = self.block1( out )
out = self.block2( out )
out = self.block3( out )
out = F.avg_pool2d( out, 7 )
out = out.view( out.size(0), -1 )
out = self.out_layer( out )
total_cost = time.time()-start
print(cost/total_cost)
return out
最后使用time模块查看该层执行效率，发现这个变换层模块占了模型99.9%的时间