[autodiff] Extract shared components for reverse and forward mode (#5088)
[autodiff] Extract shared components for reverse and forward mode (#5088)

extract shared components for reverse and forward mode
yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi