MCPcopy Create free account
hub / github.com/apple/ml-pointersect / cat

Method cat

pointersect/inference/structures.py:1314–1339  ·  view source on GitHub ↗

Concatenate a list of PointersectRecord at the given dimension. It is useful to split m_shape.

(records: T.List['PointersectRecord'], dim: int)

Source from the content-addressed store, hash-verified

1312
1313 @staticmethod
1314 def cat(records: T.List['PointersectRecord'], dim: int) -> 'PointersectRecord':
1315 """
1316 Concatenate a list of PointersectRecord at the given dimension.
1317 It is useful to split m_shape.
1318 """
1319 out = dict()
1320 for name in [
1321 'intersection_xyz_w', 'intersection_surface_normal_w', 'intersection_rgb',
1322 'blending_weights', 'neighbor_point_idxs', 'neighbor_point_valid_len',
1323 'ray_t', 'ray_hit', 'ray_hit_logit', 'model_attn_weights',
1324 'refined_ray_hit',
1325 'intersection_plane_normals_w',
1326 'geometry_weights',
1327 'valid_neighbor_idx_mask',
1328 'valid_plane_normal_mask',
1329 ]:
1330 arr = [getattr(r, name, None) for r in records]
1331 if None in arr:
1332 out[name] = None
1333 else:
1334 out[name] = torch.cat(arr, dim=dim)
1335
1336 if len(records) > 0:
1337 out['model_info'] = records[0].model_info
1338
1339 return PointersectRecord(**out)
1340
1341 def chunk(self, chunks: int, dim: int) -> T.List['PointersectRecord']:
1342 """

Callers

nothing calls this directly

Calls 2

PointersectRecordClass · 0.85
catMethod · 0.45

Tested by

no test coverage detected