add an utility function to check whether it's in the middle of onnx export or not
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/19050
Reviewed By: yinghai
Differential Revision: D14849878
Pulled By: houseroad
fbshipit-source-id: a0a4a57f5f9f315ba1334edfccc9284a8099d17f