cauchy_

paddle. cauchy_ ( x, loc=0, scale=1, name=None ) [source]

Fills the tensor with numbers drawn from the Cauchy distribution.

Parameters
  • x (Tensor) – the tensor will be filled, The data type is float32 or float64.

  • loc (scalar, optional) – Location of the peak of the distribution. The data type is float32 or float64.

  • scale (scalar, optional) – The half-width at half-maximum (HWHM). The data type is float32 or float64. Must be positive values.

  • name (str, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

input tensor with numbers drawn from the Cauchy distribution.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.randn([3, 4])
>>> x.cauchy_(1, 2)
>>> 
>>> print(x)
Tensor(shape=[3, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
[[ 3.80087137,  2.25415039,  2.77960515,  7.64125967],
 [ 0.76541221,  2.74023032,  1.99383152, -0.12685823],
 [ 1.45228469,  1.76275957, -4.30458832, 34.74880219]])