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

Commit

Permalink
enumerate instead of range(len())
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiBapchya committed Dec 5, 2018
1 parent 4328e30 commit c989695
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/mxnet/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1915,8 +1915,8 @@ def chi_square_check(generator, buckets, probs, nsamples=1000000):
if continuous_dist:
sample_bucket_ids = sample_bucket_ids // 2
obs_freq = np.zeros(shape=len(buckets), dtype=np.int)
for i in range(len(buckets)):
obs_freq[i] = (sample_bucket_ids == buckets[i]).sum()
for i, _ in enumerate(buckets):
obs_freq[i] = (sample_bucket_ids == buckets[i]).astype('uint8').sum()
_, p = ss.chisquare(f_obs=obs_freq, f_exp=expected_freq)
return p, obs_freq, expected_freq

Expand Down

0 comments on commit c989695

Please sign in to comment.