def npu_fast_condition_index_put(x, condition, value):
使用NPU亲和写法替换bool型index_put函数中的原生写法。
torch.Tensor - 框转换deltas。
from torch_npu.contrib.function import npu_fast_condition_index_put x1_opt = npu_fast_condition_index_put(x, condition, value)
>>> x = torch.randn(128, 8192)
>>> condition = x < 0.5
>>> value = 0.
>>> x1 = copy.deepcopy(x)[condition] = value
>>> x1_opt = npu_fast_condition_index_put(x, condition, value)