Will torch script support typing.Union?



any workaround?

I think torchscript supports Optional: https://pytorch.org/docs/master/jit.html#optional-type-refinement.

TorchScript doesn’t support Union. If you have a use case, opening a feature request on the repository (instead of a question) might be the way to go.