Esempio n. 1
0
 def complexity(cx, w_in, w_out, stride, w_b=None, num_gs=1):
     err_str = "Basic transform does not support w_b and num_gs options"
     assert w_b is None and num_gs == 1, err_str
     cx = net.complexity_conv2d(cx, w_in, w_out, 3, stride, 1)
     cx = net.complexity_batchnorm2d(cx, w_out)
     cx = net.complexity_conv2d(cx, w_out, w_out, 3, 1, 1)
     cx = net.complexity_batchnorm2d(cx, w_out)
     return cx
Esempio n. 2
0
 def complexity(cx, w_in, w_out, stride, w_b, num_gs):
     (s1, s3) = (stride, 1) if cfg.RESNET.STRIDE_1X1 else (1, stride)
     cx = net.complexity_conv2d(cx, w_in, w_b, 1, s1, 0)
     cx = net.complexity_batchnorm2d(cx, w_b)
     cx = net.complexity_conv2d(cx, w_b, w_b, 3, s3, 1, num_gs)
     cx = net.complexity_batchnorm2d(cx, w_b)
     cx = net.complexity_conv2d(cx, w_b, w_out, 1, 1, 0)
     cx = net.complexity_batchnorm2d(cx, w_out)
     return cx
Esempio n. 3
0
 def complexity(cx, w_in, w_out, stride, trans_fun, w_b, num_gs):
     proj_block = (w_in != w_out) or (stride != 1)
     if proj_block:
         h, w = cx["h"], cx["w"]
         cx = net.complexity_conv2d(cx, w_in, w_out, 1, stride, 0)
         cx = net.complexity_batchnorm2d(cx, w_out)
         cx["h"], cx["w"] = h, w  # parallel branch
     cx = trans_fun.complexity(cx, w_in, w_out, stride, w_b, num_gs)
     return cx
Esempio n. 4
0
 def complexity(cx, w_in, w_out):
     cx = net.complexity_conv2d(cx, w_in, w_out, 7, 2, 3)
     cx = net.complexity_batchnorm2d(cx, w_out)
     cx = net.complexity_maxpool2d(cx, 3, 2, 1)
     return cx
Esempio n. 5
0
 def complexity(cx, w_in, w_out):
     cx = net.complexity_conv2d(cx, w_in, w_out, 3, 1, 1)
     cx = net.complexity_batchnorm2d(cx, w_out)
     return cx