pfhedge.nn.functional.box_muller¶
- pfhedge.nn.functional.box_muller(input1, input2, epsilon=1e-10)[source]¶
Returns two tensors obtained by applying Box-Muller transformation to two input tensors.
\[\begin{split}& \mathrm{output1}_i = \sqrt{- 2 \log (\mathrm{input1}_i)} \cos(2 \pi \cdot \mathrm{input2}_i) , \\ & \mathrm{output2}_i = \sqrt{- 2 \log (\mathrm{input1}_i)} \sin(2 \pi \cdot \mathrm{input2}_i) .\end{split}\]- Parameters
input1 (torch.Tensor) – The first input tensor.
input2 (torch.Tensor) – The second input tensor.
epsilon (float, default=1e-10) – A small constant to avoid evaluating \(\log(0)\). The tensor
input1
will be clamped with this value being the minimum.
- Returns
(torch.Tensor, torch.Tensor)