torch.log2
- torch.log2(input, *, out=None) → Tensor
-
返回一个新张量,其中包含输入张量中每个元素以2为底的对数。
$y_{i} = \log_{2} (x_{i})$示例:
>>> a = torch.rand(5) >>> a tensor([ 0.8419, 0.8003, 0.9971, 0.5287, 0.0490]) >>> torch.log2(a) tensor([-0.2483, -0.3213, -0.0042, -0.9196, -4.3504])