MCPcopy Index your code
hub / github.com/MoonInTheRiver/DiffSinger / copy_tensor

Function copy_tensor

utils/__init__.py:49–55  ·  view source on GitHub ↗
(src, dst)

Source from the content-addressed store, hash-verified

47 res = values[0].new(len(values), size).fill_(pad_idx)
48
49 def copy_tensor(src, dst):
50 assert dst.numel() == src.numel()
51 if shift_right:
52 dst[1:] = src[:-1]
53 dst[0] = shift_id
54 else:
55 dst.copy_(src)
56
57 for i, v in enumerate(values):
58 copy_tensor(v, res[i][size - len(v):] if left_pad else res[i][:len(v)])

Callers 2

collate_1dFunction · 0.85
collate_2dFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected