简体   繁体   中英

fp16 inference on cpu Pytorch

I have a pretrained pytorch model I want to inference on fp16 instead of fp32 , I have already tried this while using the gpu but when I try it on cpu I get: "sum_cpu" not implemented for 'Half' torch . any fixes?

As I know, a lot of CPU-based operations in Pytorch are not implemented to support FP16; instead, it's NVIDIA GPUs that have hardware support for FP16(eg tensor cores in Turing arch GPU) and PyTorch followed up since CUDA 7.0(ish). To accelerate inference on CPU by quantization to FP16, you may wanna try torch.bfloat16 dtype( https://github.com/pytorch/pytorch/issues/23509 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM