PyTorch torch.log2 Function


Pytorch torch 参考手册PyTorch torch Reference Manual

torch.log2Is a function in PyTorch used to compute the base-2 logarithm.

Function Definition

torch.log2(input, out)

Usage Example

Example

import torch

# Compute the base-2 logarithm
x = torch.tensor([1, 2, 4, 8, 16])
result = torch.log2(x)
print(result)

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions