quantize

dnois.sensor.quantize(signal: Tensor, levels: int = 256, differentiable: bool = False) Tensor

Quantize continuous-valued signal, emulating an analogous-to-digital conversion.

Parameters:
  • signal (Tensor) – The signal to be quantized whose value must be in \([0,1]\).

  • levels (int) – Quantization levels. 256 for example, which is the number of levels for most image sensors. Default: 256.

  • differentiable (bool) – Whether to perform quantization in a differentiable manner. Specifically, if True, a quantization noise will be added to signal to simulate quantization. Default: False.

Returns:

Quantized signal.

Return type:

Tensor