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

Function pad_last_frame

sat/data_utils.py:90–97  ·  view source on GitHub ↗
(tensor, num_frames)

Source from the content-addressed store, hash-verified

88
89
90def pad_last_frame(tensor, num_frames):
91 # T, H, W, C
92 if tensor.shape[0] < num_frames:
93 last_frame = tensor[-int(num_frames - tensor.shape[1]) :]
94 padded_tensor = torch.cat([tensor, last_frame], dim=0)
95 return padded_tensor
96 else:
97 return tensor[:num_frames]
98
99def load_image_to_tensor(image_path):
100 if not os.path.exists(image_path):

Callers 1

read_img_listMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected