Hello,
was this ever fixed ?
/usr/local/lib/python3.5/dist-packages/torchtext/data/field.py:308: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
it refers to this line in master:
https://github.com/pytorch/text/blob/master/torchtext/data/field.py#L359
also what if you need to convert tensor to dtype=torch.float ?
replacing with clone().detach() is not going to convert the tensor....
Could you provide the case where you get this error?
I assume that arr is a torch.tensor, which means that the numericalization / postprocessing casts it into that at some point (as the standard pipeline shouldn't do that prior to L359).
@toli-belo feel free to reopen the issue if you still have questions.
for future reference: https://github.com/pytorch/pytorch/issues/16627. In summary, try to replace torch.tensor with torch.as_tensor
Most helpful comment
for future reference: https://github.com/pytorch/pytorch/issues/16627. In summary, try to replace
torch.tensorwithtorch.as_tensor