Skip to content

Commit

Permalink
update doc test
Browse files Browse the repository at this point in the history
  • Loading branch information
NKNaN committed Dec 14, 2023
1 parent 1f8c1ef commit 9a63ead
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/paddle/distribution/binomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Binomial(distribution.Distribution):
>>> print(rv.entropy())
Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
[2.94057941, 3.00785327, 2.51125669])
[2.94053698, 3.00781751, 2.51124287])
"""

def __init__(self, total_count, probability):
Expand Down
8 changes: 5 additions & 3 deletions python/paddle/distribution/poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class Poisson(distribution.Distribution):
>>> import paddle
>>> from paddle.distribution import Poisson
>>> paddle.set_device('cpu')
>>> paddle.seed(100)
>>> rv = Poisson(paddle.to_tensor(30.0))
>>> print(rv.sample([3]))
Expand All @@ -62,12 +64,12 @@ class Poisson(distribution.Distribution):
Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
[3.11671066])
>>> rv1 = Poisson(paddle.to_tensor([[30,40],[8,5]]))
>>> rv2 = Poisson(paddle.to_tensor([[1000,40],[7,10]]))
>>> rv1 = Poisson(paddle.to_tensor([[30.,40.],[8.,5.]]))
>>> rv2 = Poisson(paddle.to_tensor([[1000.,40.],[7.,10.]]))
>>> print(rv1.kl_divergence(rv2))
Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
[[864.80285645, 0. ],
[0.06825072 , 1.53426421 ]])
[0.06825157 , 1.53426421 ]])
"""

def __init__(self, rate):
Expand Down

0 comments on commit 9a63ead

Please sign in to comment.