RuntimeError expected scalar type Float but found Half
This error occurs when there is a mismatch between the expected data type and the actual data type in a PyTorch tensor.
In this case, the error is indicating that a tensor with data type "Half" was encountered, but the expected data type was "Float".
To resolve this error, you can try converting the tensor to the expected data type using the float() method. For example:
tensor = tensor.float()
Alternatively, you can check the code where the tensor is created or modified, and ensure that the correct data type is used. For example, if you are using a pretrained model that expects float inputs, make sure to pass float inputs to the model
原文地址: https://www.cveoy.top/t/topic/hKpO 著作权归作者所有。请勿转载和采集!