评价此页

torch.Tensor.apply_#

Tensor.apply_(callable) Tensor#

将函数 callable 应用于张量中的每个元素,并将每个元素替换为 callable 返回的值。

注意

此函数仅适用于 CPU 张量,不应在需要高性能的代码部分中使用。