megengine.dtr.eviction_threshold

eviction_threshold = <property object>

Get or set the eviction threshold in bytes. It can also be set to a string, whose formatting supports byte(B), kilobyte(KB), megabyte(MB) and gigabyte(GB) units.

注解

When GPU memory usage exceeds this value, DTR will heuristically select and evict resident tensors until the amount of used memory falls below this threshold.

实际案例

import megengine as mge
mge.dtr.eviction_threshold = "2GB"