File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -318,25 +318,24 @@ class RandomErase:
318
318
>>> erase = RandomErase(n_points=100)
319
319
>>> erase(pcd)
320
320
Traceback (most recent call last):
321
- ..
322
- ValueError : resulting point cloud has no points
321
+ ...
322
+ RuntimeError : resulting point cloud has no points
323
323
"""
324
324
def __init__ (self , n_points ):
325
+ if n_points < 0 :
326
+ raise ValueError ("'n_points' can't be negative" )
325
327
self .n_points = n_points
326
328
327
329
def __call__ (self , pcd ):
328
330
check_shape (pcd )
329
331
330
- if self .n_points < 0 :
331
- raise ValueError ("'n_points' can't be negative" )
332
-
333
332
if 0 < self .n_points < 1 :
334
333
keep_size = len (pcd ) - int (len (pcd ) * self .n_points )
335
334
else :
336
335
keep_size = len (pcd ) - self .n_points
337
336
338
337
if keep_size < 1 :
339
- raise ValueError ('resulting point cloud has no points' )
338
+ raise RuntimeError ('resulting point cloud has no points' )
340
339
341
340
# Indices of points to keep.
342
341
indices = torch .randperm (len (pcd ))[:keep_size ]
@@ -369,14 +368,13 @@ class RandomSample:
369
368
True
370
369
"""
371
370
def __init__ (self , size ):
371
+ if size < 0 :
372
+ raise ValueError ("'size' can't be negative" )
372
373
self .size = size
373
374
374
375
def __call__ (self , pcd ):
375
376
check_shape (pcd )
376
377
377
- if self .size < 0 :
378
- raise ValueError ("'size' can't be negative" )
379
-
380
378
if self .size >= len (pcd ):
381
379
return pcd
382
380
You can’t perform that action at this time.
0 commit comments