paulguerrero / pcpnet

Pytorch implementation of PCPNet
Other
169 stars 41 forks source link

Crash when using curvature model on PyTorch 1.0 #2

Closed hauensj1 closed 5 years ago

hauensj1 commented 5 years ago

When using PyTorch 1.0 (and possibly 0.4?), the example eval_pcpnet.py crashes when using the --models "single_scale_normal_curv" option:

$ python3 eval_pcpnet.py --models "single_scale_normal_curv"
Random Seed: [number]
getting information for shape galera100k
getting information for shape icosahedron100k
getting information for shape netsuke100k
getting information for shape Cup34100k
getting information for shape sphere100k
getting information for shape cylinder100k
getting information for shape star_smooth100k
getting information for shape star_halfsmooth100k
getting information for shape star_sharp100k
getting information for shape Liberty100k
getting information for shape boxunion2100k
getting information for shape pipe100k
getting information for shape pipe_curve100k
getting information for shape column100k
getting information for shape column_head100k
getting information for shape Boxy_smooth100k
getting information for shape sphere_analytic100k
getting information for shape cylinder_analytic100k
getting information for shape sheet_analytic100k
[single_scale_normal_curv 0/29687] shape galera100k
[single_scale_normal_curv 1/29687] shape galera100k
[single_scale_normal_curv 2/29687] shape galera100k
[single_scale_normal_curv 3/29687] shape galera100k
[single_scale_normal_curv 4/29687] shape galera100k
[single_scale_normal_curv 5/29687] shape galera100k

[snip]

[single_scale_normal_curv 1556/29687] shape galera100k
[single_scale_normal_curv 1557/29687] shape galera100k
[single_scale_normal_curv 1558/29687] shape galera100k
[single_scale_normal_curv 1559/29687] shape galera100k
[single_scale_normal_curv 1560/29687] shape galera100k
[single_scale_normal_curv 1561/29687] shape galera100k
[single_scale_normal_curv 1562/29687] shape galera100k
Traceback (most recent call last):
  File "eval_pcpnet.py", line 255, in <module>
    eval_pcpnet(eval_opt)
  File "eval_pcpnet.py", line 224, in eval_pcpnet
    curv_prop[:, 0] = shape_properties[:, output_pred_ind[oi1]:output_pred_ind[oi1]+1]
RuntimeError: expand(torch.cuda.FloatTensor{[100000, 1]}, size=[100000]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

I think it should be fixable by calling squeeze on the RHS:

curv_prop[:, 0] = shape_properties[:, output_pred_ind[oi1]:output_pred_ind[oi1]+1].squeeze()

This change at least avoids the crash, but I haven't verified the results as yet. The line storing the second curvature also needs to be changed.

paulguerrero commented 5 years ago

Right, thanks for pointing that out, I have fixed the code.