megengine.dtr.enable_sqrt_sampling#

enable_sqrt_sampling = <property object>#

获取或设置是否允许 sqrt 采样。 sqrt 采样意味着给定候选集的大小为 N,枚举 sqrt(N)。 当 Tensor 的数量非常多时,启用此优化将加快训练速度。

实际案例

import megengine as mge
mge.dtr.enable_sqrt_sampling = True