MCPcopy Create free account
hub / github.com/Hzfinfdu/Diffusion-BERT / scan

Function scan

utils.py:12–21  ·  view source on GitHub ↗
(f, init, xs, length=None)

Source from the content-addressed store, hash-verified

10
11
12def scan(f, init, xs, length=None):
13 if xs is None:
14 xs = [None] * length
15 carry = init
16 ys = []
17 for x in xs:
18 carry, y = f(carry, x)
19 ys.append(y)
20
21 return carry, torch.stack(ys) if ys[0] is not None else None
22
23
24def word_frequency(path, basic_freq=.5):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected