MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / remove_padding

Function remove_padding

utils/__init__.py:212–219  ·  view source on GitHub ↗
(x, padding_idx=0)

Source from the content-addressed store, hash-verified

210
211
212def remove_padding(x, padding_idx=0):
213 if x is None:
214 return None
215 assert len(x.shape) in [1, 2]
216 if len(x.shape) == 2: # [T, H]
217 return x[np.abs(x).sum(-1) != padding_idx]
218 elif len(x.shape) == 1: # [T]
219 return x[x != padding_idx]
220
221
222class Timer:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected