Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stochastic failure in WalkerAlias #6057

Merged
merged 1 commit into from Jan 23, 2019

Conversation

asi1024
Copy link
Member

@asi1024 asi1024 commented Jan 22, 2019

Fix #6045.

@niboshi
Copy link
Member

niboshi commented Jan 22, 2019

Please write come comments. This workaround is not intuitive.

@niboshi
Copy link
Member

niboshi commented Jan 22, 2019

How about this? I think it's simpler.

    def sample_xp(self, xp, shape):
        thr_dtype = self.threshold.dtype
        pb64 = xp.random.uniform(0, len(self.threshold), shape)
        index = pb64.astype(numpy.int32)
        left_right = (
            self.threshold[index]
            < (pb64.astype(thr_dtype) - index.astype(thr_dtype)))
        left_right = left_right.astype(numpy.int32)
        return self.values[index * 2 + left_right]

By the way, it seems this problem has been introduced in this commit.
(Apparently, the purpose of the fix was to support ChainerX which does not support implicit dtype promotion.)

@niboshi
Copy link
Member

niboshi commented Jan 23, 2019

Jenkins, test this please

@niboshi niboshi added cat:bug Bug report or fix. cat:test Test or CI related. and removed cat:test Test or CI related. labels Jan 23, 2019
@niboshi niboshi added this to the v6.0.0b2 milestone Jan 23, 2019
@niboshi niboshi added the st:test-and-merge State indicating that pull request is approved by a reviewer and can be merged after CI passes. label Jan 23, 2019
@chainer-ci
Copy link
Member

Jenkins CI test (for commit 2d75429, target branch master) succeeded!

@niboshi
Copy link
Member

niboshi commented Jan 23, 2019

LGTM

@niboshi niboshi changed the title Fix occasional test failure of TestWalkerAlias Fix stochastic failure in WalkerAlias Jan 23, 2019
@niboshi niboshi merged commit 010d676 into chainer:master Jan 23, 2019
@asi1024 asi1024 deleted the fix-walkeralias branch January 23, 2019 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:bug Bug report or fix. st:test-and-merge State indicating that pull request is approved by a reviewer and can be merged after CI passes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants