lin_to_db#

sionna.phy.utils.lin_to_db(x: float | torch.Tensor, precision: Literal['single', 'double'] | None = None, device: str | None = None) torch.Tensor[source]#

Converts the input in linear scale to dB scale.

Parameters:
  • x (float | torch.Tensor) – Input value in linear scale.

  • precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None, precision is used.

  • device (str | None) – Device for the output tensor. If None and x is a tensor, uses the device of x. Otherwise uses device.

Outputs:

x_db – Input value converted to dB.

Examples

import torch
from sionna.phy.utils import lin_to_db

x = torch.tensor(100.0)
print(lin_to_db(x).item())
# 20.0