Text: Numericalize torch.FloatTensor and torch.DoubleTensor

Created on 10 May 2019  路  3Comments  路  Source: pytorch/text

Hi,

I was unable to use floating-point labels using the following field declaration:

LABEL = data.Field(sequential=False, use_vocab=False, is_target=True, dtype=torch.DoubleTensor)

Got this error: "Specified Field dtype can not be used with use_vocab=False because we do not know how to numericalize it"

Would it be straight-forward to numericalize such fields?

Thanks!

Most helpful comment

Hi, instead of using a concrete class for the dtype argument, you should use torch dtypes, ex:
LABEL = data.Field(sequential=False, use_vocab=False, is_target=True, dtype=torch.float64)

All 3 comments

Hi, instead of using a concrete class for the dtype argument, you should use torch dtypes, ex:
LABEL = data.Field(sequential=False, use_vocab=False, is_target=True, dtype=torch.float64)

@shafiul if the issue is resolved, please feel free to close the issue. Thanks.

Hi, sorry for the late response. Thank you for the feedback.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aatkinson picture aatkinson  路  3Comments

lsh23 picture lsh23  路  3Comments

srush picture srush  路  6Comments

wpfnlp picture wpfnlp  路  5Comments

pasinit picture pasinit  路  3Comments