geometric_

paddle. geometric_ ( x, probs, name=None ) [source]

Fills the tensor with numbers drawn from the Geometric distribution.

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

  • probs (Real|Tensor) – Probability parameter. The value of probs must be positive. When the parameter is a tensor, probs is probability of success for each trial.

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

Returns

input tensor with numbers drawn from the Geometric distribution.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.randn([3, 4])
>>> x.geometric_(0.3)
>>> 
>>> print(x)
Tensor(shape=[3, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
[[2.42739224, 4.78268528, 1.23302543, 3.76555204],
 [1.38877118, 0.16075331, 0.16401523, 2.47349310],
 [1.72872102, 2.76533413, 0.33410925, 1.63351011]])