Shortcuts

torch.Tensor.apply_

Tensor.apply_(callable) 张量

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

注意

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

优云智算