Concatenate a list of Points into a single Points. Args: points_list (Sequence[:obj:`BasePoints`]): List of points. Returns: :obj:`BasePoints`: The concatenated points.
(cls, points_list: Sequence['BasePoints'])
| 402 | |
| 403 | @classmethod |
| 404 | def cat(cls, points_list: Sequence['BasePoints']) -> 'BasePoints': |
| 405 | """Concatenate a list of Points into a single Points. |
| 406 | |
| 407 | Args: |
| 408 | points_list (Sequence[:obj:`BasePoints`]): List of points. |
| 409 | |
| 410 | Returns: |
| 411 | :obj:`BasePoints`: The concatenated points. |
| 412 | """ |
| 413 | assert isinstance(points_list, (list, tuple)) |
| 414 | if len(points_list) == 0: |
| 415 | return cls(torch.empty(0)) |
| 416 | assert all(isinstance(points, cls) for points in points_list) |
| 417 | |
| 418 | # use torch.cat (v.s. layers.cat) |
| 419 | # so the returned points never share storage with input |
| 420 | cat_points = cls(torch.cat([p.tensor for p in points_list], dim=0), |
| 421 | points_dim=points_list[0].points_dim, |
| 422 | attribute_dims=points_list[0].attribute_dims) |
| 423 | return cat_points |
| 424 | |
| 425 | def numpy(self) -> np.ndarray: |
| 426 | """Reload ``numpy`` from self.tensor.""" |
no outgoing calls
no test coverage detected