How to use mixed precision training models in libtorch

Thanks to anyone for providing clues

An ancient snippet from the author of AMP that might be relevant… autocast get OOM with c++ api · Issue #46649 · pytorch/pytorch · GitHub

thanks any way, after at::autocast::set_enabled(true);The model accuracy has decreased。