Hi,
The embedding layer takes as input the index of the element in the embedding you want to select and return the corresponding embedding. The input is expected to be a LongTensor because it is an index and so must be an integer. The output is a float type, you can call .float()
or .double()
on the nn.Module to change between float32 and float64.
The lstm takes float type for both input and output and can be switches between single and double precision with .float()
and .double()
as well.
Change of types are considered as any other operations by the autograd engine and so all the gradients will be computed properly. Note that there might be a loss of precision of going from double to float as you would expect.