MCPcopy Create free account
hub / github.com/openai/point-e / random_sample

Method random_sample

point_e/util/point_cloud.py:68–80  ·  view source on GitHub ↗

Sample a random subset of this PointCloud. :param num_points: maximum number of points to sample. :param subsample_kwargs: arguments to self.subsample(). :return: a reduced PointCloud, or self if num_points is not less than the current number of poi

(self, num_points: int, **subsample_kwargs)

Source from the content-addressed store, hash-verified

66 )
67
68 def random_sample(self, num_points: int, **subsample_kwargs) -> "PointCloud":
69 """
70 Sample a random subset of this PointCloud.
71
72 :param num_points: maximum number of points to sample.
73 :param subsample_kwargs: arguments to self.subsample().
74 :return: a reduced PointCloud, or self if num_points is not less than
75 the current number of points.
76 """
77 if len(self.coords) <= num_points:
78 return self
79 indices = np.random.choice(len(self.coords), size=(num_points,), replace=False)
80 return self.subsample(indices, **subsample_kwargs)
81
82 def farthest_point_sample(
83 self, num_points: int, init_idx: Optional[int] = None, **subsample_kwargs

Callers

nothing calls this directly

Calls 1

subsampleMethod · 0.95

Tested by

no test coverage detected