Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/tensorpack/tensorpack
/ pick
Function
pick
examples/Char-RNN/char-rnn.py:150–153 ·
view source on GitHub ↗
(prob)
Source
from the content-addressed store, hash-verified
148
_, state = pred(x, initial, initial, initial, initial)
149
150
def
pick(prob):
151
t = np.cumsum(prob)
152
s = np.sum(prob)
153
return
(int(np.searchsorted(t, np.random.rand(1) * s)))
154
155
# generate more
156
ret = start
Callers
1
sample
Function · 0.85
Calls
1
sum
Method · 0.80
Tested by
no test coverage detected