How to use kDouble type input for Linear layer in C++

We use


to create a Linear layer. However it looks like that the default type of it is kFloat. If x is kDouble type, then linear3->forward(x) will generate an error.

Then how do we use double type data as input?

I found that one can use;

to cast parameters of the whole model to double type.