MCPcopy
hub / github.com/vladmandic/sdnext / _expand_for_blocking

Function _expand_for_blocking

modules/sharpfin/sparse_backend.py:328–340  ·  view source on GitHub ↗
(idxs, blocking)

Source from the content-addressed store, hash-verified

326
327@torch.no_grad()
328def _expand_for_blocking(idxs, blocking):
329 idxs = torch.reshape(idxs, [idxs.size()[0], 1, 2]).repeat(1, blocking, 1)
330
331 idxs[:, :, 1] *= blocking
332 idxs[:, :, 1] += torch.reshape(torch.arange(blocking, device=idxs.device), [1, blocking])
333
334 idxs = torch.reshape(idxs, [idxs.size()[0], 1, blocking, 2])
335 idxs = idxs.repeat(1, blocking, 1, 1)
336
337 idxs[:, :, :, 0] *= blocking
338 idxs[:, :, :, 0] += torch.reshape(torch.arange(blocking, device=idxs.device), [1, blocking, 1])
339 idxs = torch.reshape(idxs, [-1, 2])
340 return idxs
341
342
343@torch.no_grad()

Callers 1

to_denseFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected