megengine.amp

enabled

Get or set amp autocast mode enabled or not.

实际案例

import megengine as mge
mge.amp.enabled = True
high_prec_dtype

Get or set amp autocast mode’s higher precision dtype. It will change the target dtype in tensor casting for better precision. Default: float32.

实际案例

import megengine as mge
mge.amp.high_prec_dtype = "float32"
low_prec_dtype

Get or set amp autocast mode’s lower precision dtype. It will change the target dtype in tensor casting for better speed and memory. Default: float16.

实际案例

import megengine as mge
mge.amp.low_prec_dtype = "float16"