def __init__(self, num_dims: int, num_freqs: int, log_space: bool = False) -> None:
        """Initialize positional encoder.

        Args:
            num_dims: Number of input dimensions (channels): int
            num_freqs: Number of frequency bands for encoding span: int
            log_space: Whether frequency sampling should be log spaced: bool

        """
        super().__init__()
        self._num_dims = num_dims
        self._embed_fns = [lambda x: x]

        # Define frequencies in either linear or log scale
        freq_bands: Tensor
        if log_space:
            freq_bands = 2.0 ** torch.linspace(0.0, num_freqs - 1, num_freqs)
        else:
            freq_bands = torch.linspace(2.0**0.0, 2.0 ** (num_freqs - 1), num_freqs)

        # Alternate sin and cos
        for freq in freq_bands:
            self._embed_fns.append(partial(_torch_sin, freq=freq))
            self._embed_fns.append(partial(_torch_cos, freq=freq))

        self._num_encoded_dims = self._num_dims * len(self._embed_fns)
Initialize positional encoder.

        Args:
            num_dims: Number of input dimensions (channels): int
            num_freqs: Number of frequency bands for encoding span: int
            log_space: Whether frequency sampling should be log spaced: bool

        
kornia/nerf/positional_encoder.py