Add forward AD support for custom Functions (#64061)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64061
Test Plan: Imported from OSS
Reviewed By: soulitzer
Differential Revision: D30640868
Pulled By: albanD
fbshipit-source-id: b0e6610430a879074d6d5306443772fc154b431f