MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / pad_at_dim

Function pad_at_dim

sat/sgm/modules/autoencoding/magvit2_pytorch.py:100–103  ·  view source on GitHub ↗
(t, pad, dim=-1, value=0.0)

Source from the content-addressed store, hash-verified

98
99
100def pad_at_dim(t, pad, dim=-1, value=0.0):
101 dims_from_right = (-dim - 1) if dim < 0 else (t.ndim - dim - 1)
102 zeros = (0, 0) * dims_from_right
103 return F.pad(t, (*zeros, *pad), value=value)
104
105
106def pick_video_frame(video, frame_indices):

Callers 2

forwardMethod · 0.85
encodeMethod · 0.85

Calls 1

padMethod · 0.80

Tested by

no test coverage detected