Hi,
I’ve tried to work around the issue as:
class ProsodyGeneratorExport(ProsodyGenerator):
    def __init__(self, hparams):
        super().__init__(hparams)

    def forward(self,
                text_inputs: Tensor,
                speaker_embed: Optional[Tensor]=None,
                style_embed: Optional[Tensor]=None):
        return self.inference(text_inputs, speaker_embed, style_embed)

And calling optimize_for_mobile without the preserved_methods parameter:
ts_prosody_mobile = optimize_for_mobile(ts_prosody)

ts_prosody_mobile.forward() can be called.
Exporting with torch.jit.save and then loading into Java again:
        IValue[] prosodyOutput = modelProsody.forward(
                IValue.from(textInputTensor),
                IValue.from(speakerInputTensor),
                IValue.from(styleInputTensor)).toTuple();

gives me
com.facebook.jni.CppException: Method 'forward' is not defined.
    Exception raised from get_method at ../../../../src/main/cpp/libtorch_include/arm64-v8a/torch/csrc/jit/api/object.h:103 (most recent call first):
    (no backtrace available)

Again the same code loading the model without optimize_for_mobile works.
So I ended up instead refactoring my classes from forward/inference to forward_train/forward and now it works.
Only that (without any further quantization or fuse calls) the optimize_for_mobile version runs 5 seconds for a given task while the unoptimized one runs for 4 seconds.