MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / get_flattened_position_ids_extrapolate

Function get_flattened_position_ids_extrapolate

data/data_utils.py:50–55  ·  view source on GitHub ↗
(img_h, img_w, patch_size, max_num_patches_per_side)

Source from the content-addressed store, hash-verified

48
49
50def get_flattened_position_ids_extrapolate(img_h, img_w, patch_size, max_num_patches_per_side):
51 num_patches_h, num_patches_w = img_h // patch_size, img_w // patch_size
52 coords_h = torch.arange(0, num_patches_h)
53 coords_w = torch.arange(0, num_patches_w)
54 pos_ids = (coords_h[:, None] * max_num_patches_per_side + coords_w).flatten()
55 return pos_ids
56
57# if (height, width) not in self.position_cache:
58# y_coords = torch.arange(height, device=device)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected