What is the correct and efficient way to ensure float32 for ScalarImages? #837
-
When I apply a torchio affine transform on my scalar images during model training, the dtype changes from Double to Float, which is fine. However for the validation set, no transform is used and the images are passed to the the model as Double-tensors. This causes a RuntimeError due to a type mismatch between the model (Float) and input images (Double). Do I need to make a custom ToFloat transform or is there an argument somewhere that will ensure a certain datatype? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, @ChristianHinge. We don't have a standard casting method at the moment. What about just calling the |
Beta Was this translation helpful? Give feedback.
Hi, @ChristianHinge. We don't have a standard casting method at the moment. What about just calling the
float
method of the tensor before feeding it to the model?