Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fix negative binomial cases. #18858

Merged
merged 2 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/python/unittest/test_gluon_probability_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def hybrid_forward(self, F, n, params, *args):
# Test log_prob
for shape, hybridize, use_logit in itertools.product(shapes, [True, False], [True, False]):
n = np.random.randint(1, 10, size=shape).astype('float32')
prob = np.random.uniform(low=0.1, size=shape).astype('float32')
prob = np.random.uniform(low=0.2, high=0.6, size=shape).astype('float32')
sample = np.random.randint(0, 10, size=shape).astype('float32')
param = prob
if use_logit:
Expand All @@ -559,7 +559,7 @@ def hybrid_forward(self, F, n, params, *args):
for func in ['mean', 'variance']:
for use_logit in [True, False]:
n = np.random.randint(1, 10, size=shape).astype('float32')
prob = np.random.uniform(low=0.1, size=shape).astype('float32')
prob = np.random.uniform(low=0.2, high=0.6, size=shape).astype('float32')
net = TestNegativeBinomial(func, use_logit)
param = prob
if use_logit:
Expand Down
4 changes: 2 additions & 2 deletions tests/python/unittest/test_gluon_probability_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def forward(self, n, params, *args):
# Test log_prob
for shape, hybridize, use_logit in itertools.product(shapes, [True, False], [True, False]):
n = np.random.randint(1, 10, size=shape).astype('float32')
prob = np.random.uniform(low=0.1, size=shape)
prob = np.random.uniform(low=0.2, high=0.6, size=shape)
sample = np.random.randint(0, 10, size=shape).astype('float32')
param = prob
if use_logit:
Expand All @@ -559,7 +559,7 @@ def forward(self, n, params, *args):
for func in ['mean', 'variance']:
for use_logit in [True, False]:
n = np.random.randint(1, 10, size=shape).astype('float32')
prob = np.random.uniform(low=0.1, size=shape)
prob = np.random.uniform(low=0.2, high=0.6, size=shape)
net = TestNegativeBinomial(func, use_logit)
param = prob
if use_logit:
Expand Down