[Bug Fix] fix the bug in test_sampler #3157
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pcard-71500
修复
test/layers/test_sampler.py
单测执行出错的BUG。问题分析:
PR #2872 向
sampling_metadata
中,新增了一个min_p
属性默认值为None,同时在forward中添加了一个必定会执行的probs = min_p_sampling(probs, sampling_metadata.min_p)
步骤,又因为test/layers/test_sampler.py
中的sampling_metadata
没有初始化min_p
属性,导致执行到min_p_sampling
时传入了min_p=None
导致报错。解决方案:
在
test/layers/test_sampler.py
单测中,添加min_p
的初始化。修复前报错内容如下: