jeanfeydy / geomloss

Geometric loss functions between point clouds, images and volumes
MIT License
586 stars 57 forks source link

ValueError: arange: cannot compute length #44

Open AEGISEDGE opened 3 years ago

AEGISEDGE commented 3 years ago

First of all, geomloss is a great llibrary. It's quite ez to use in my project. Thx for ur effort for such a great library.

Recently, I have tried SampleLoss for my data. Everything is going well at the begining. After few epochs training, it raised a ValueError:

` File "/home/lly/prj/ASTM/20news/Gamma_T50-parameter1/model.py", line 65, in Sinkhorn_divergence

return self.OTD(alpha, beta)

File "/home/lly/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl

result = self.forward(*input, **kwargs)

File "/home/lly/anaconda3/lib/python3.8/site-packages/geomloss/samples_loss.py", line 231, in forward

values = routines[self.loss][backend]( α, x, β, y, 

File "/home/lly/anaconda3/lib/python3.8/site-packages/geomloss/sinkhorn_samples.py", line 48, in sinkhorn_tensorized

diameter, ε, ε_s, ρ = scaling_parameters( x, y, p, blur, reach, diameter, scaling )

File "/home/lly/anaconda3/lib/python3.8/site-packages/geomloss/sinkhorn_divergence.py", line 72, in scaling_parameters

ε_s = epsilon_schedule( p, diameter, blur, scaling )

File "/home/lly/anaconda3/lib/python3.8/site-packages/geomloss/sinkhorn_divergence.py", line 60, in epsilon_schedule

+ [ np.exp(e) for e in np.arange(p*np.log(diameter), p*np.log(blur), p*np.log(scaling)) ] \

ValueError: arange: cannot compute length `

Then I switch to some vanilla distribution samples: LogNormal distribution for alpha and LogNormal with 0 mean and 1.0 std for beta. After few epochs training, this error came again. So I wonder what should I do to keep it working properly. Thank you!

yxchng commented 1 year ago

Any update on this problem?