Closed brudfors closed 2 years ago
What kind of error did you get?
If we go with this change, can you make it aff = aff.to(torch.float64, dat.device)
instead?
Here is the error:
OK. I'd rather add aff = aff.to(X.dtype)
at line 311 of _fit.py
, so that we work with a single datatype.
And if we see numerical problems, we can always switch to double. But I find that it's a pain to works with mixed types in PyTorch (since so many operations are not implemented)
@balbasty, okay, done. Please merge if happy!
Thanks :)
@balbasty, UniSeg errored for me because the input affine I gave was torch32. think it is best to use double data type for the SPM atlas affine matrix because it is what is returned by default when reading with io.map().affine, plus it is better for numerical precision without much memory overhead.