google / google/lyra

Why does the sampling result need to be multiplied by 256?

Open
#139 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
4k
Forks
368
PR merge metrics
No merged PRs in 30d

Description

Hi, in project_and_sample.h of Lyra-0.0.2-release, why does the sampling result be multipled by 256?
float f_result = mean + scale * log((1.0f - prob) / prob);
int result = std::min(static_cast(std::numeric_limits::max()),
std::max(static_cast(std::numeric_limits::min()),
static_cast(f_result * 256)));

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.