評價此頁

torch.Tensor.apply_#

Tensor.apply_(callable) Tensor#

將函式 callable 應用於張量中的每個元素,並將每個元素替換為 callable 返回的值。

注意

此函式僅適用於 CPU 張量,不應在需要高效能的程式碼部分中使用。