I am not sure how many people have been confused by symbol_fcnxs.py
when reading it for the first time. I did. The most confusing part is possibly the following codes used to compute the offset
for the cropping layers.
def filter_map(kernel=1, stride=1, pad=0):
return (stride, (kernel-stride)/2-pad)
def compose_fp(fp_first, fp_second):
return (fp_first[0]*fp_second[0], fp_first[0]*fp_second[1]+fp_first[1])
def compose_fp_list(fp_list):
fp_out = (1.0, 0.0)
for fp in fp_list:
fp_out = compose_fp(fp_out, fp)
return fp_out
def inv_fp(fp_in):
return (1.0/fp_in[0], -1.0*fp_in[1]/fp_in[0])
After deriving the offset
manually, I finally understand this part. For your information, I have written a blob post which explains the computation logic.