bryandlee / animegan2-pytorch

PyTorch implementation of AnimeGANv2
MIT License
4.41k stars 641 forks source link

Make model.Generator serializable to TorchScript #47

Open chrisklaiber opened 2 years ago

chrisklaiber commented 2 years ago

Test command to serialize the model:

python -c 'import torch ; import model ; m = model.Generator() ; s = torch.jit.script(m)'

Before this change there were two errors during serialization. First, the interpolate call expects a float rather than an integer:

RuntimeError: Arguments for call are not valid.

Second was the types on the forward call:

RuntimeError: Expected a default value of type Tensor (inferred) on parameter "align_corners".Because "align_corners" was not annotated with an explicit type it is assumed to be type 'Tensor'.: