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

Method random_sample

shap_e/rendering/point_cloud.py:131–143  ·  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

129 )
130
131 def random_sample(self, num_points: int, **subsample_kwargs) -> "PointCloud":
132 """
133 Sample a random subset of this PointCloud.
134
135 :param num_points: maximum number of points to sample.
136 :param subsample_kwargs: arguments to self.subsample().
137 :return: a reduced PointCloud, or self if num_points is not less than
138 the current number of points.
139 """
140 if len(self.coords) <= num_points:
141 return self
142 indices = np.random.choice(len(self.coords), size=(num_points,), replace=False)
143 return self.subsample(indices, **subsample_kwargs)
144
145 def farthest_point_sample(
146 self, num_points: int, init_idx: Optional[int] = None, **subsample_kwargs

Callers 2

mv_to_pcFunction · 0.95
sample_fpsFunction · 0.80

Calls 1

subsampleMethod · 0.95

Tested by

no test coverage detected