I traced the script from python pytorch implementation. But when I am trying to perform a model inference on the C++ code, I keep getting the following error.
Here is my code
  std::shared_ptr<torch::jit::script::Module> module =
      torch::jit::load(fileName);
  std::cout<< "Successfully read file \t" << std::string(fileName) << "\n";

  float InputData[] = {0.8, 0.001, 0.2, 0.0001};
  at::Tensor inpTensor = torch::from_blob(InputData, {4, 1}, at::kFloat);
  std::vector<torch::jit::IValue> inputs;
  std::cout << "Input tensor\t" << inpTensor << '\n';
  inputs.emplace_back(inpTensor);
  std::cout <<"After emplace\t" << inputs  << '\n';
// Execute the model and turn its output into a tensor.
  at::Tensor output = module->forward(inputs).toTensor();

And the error message is
libc++abi.dylib: terminating with uncaught exception of type c10::Error: Expected object of scalar type Float but got scalar type Double for argument #2 'mat2' (checked_tensor_unwrap at /Users/soumith/b101/2019_02_04/wheel_build_dirs/libtorch_2.7/pytorch/aten/src/ATen/Utils.h:74)
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 64 (0x105ea5fb0 in libc10.dylib)
frame #1: at::checked_tensor_unwrap(at::Tensor const&, char const*, int, bool, c10::Backend, c10::ScalarType) + 524 (0x1074a23dc in libcaffe2.dylib)
frame #2: at::CPUFloatType::_th_mm(at::Tensor const&, at::Tensor const&) const + 772 (0x1074b76e4 in libcaffe2.dylib)
frame #3: at::native::mm(at::Tensor const&, at::Tensor const&) + 468 (0x1072d0514 in libcaffe2.dylib)
frame #4: at::TypeDefault::mm(at::Tensor const&, at::Tensor const&) const + 222 (0x1075e0ade in libcaffe2.dylib)
frame #5: torch::autograd::VariableType::mm(at::Tensor const&, at::Tensor const&) const + 2588 (0x104da16bc in libtorch.1.dylib)

The output of the code shows that I am passing the input (which should be an array with 4 floats) as floats.
Input tensor	 0.8000
 0.0010
 0.2000
 0.0001
[ Variable[CPUFloatType]{4,1} ]
After emplace	 0.8000
 0.0010
 0.2000
 0.0001
[ Variable[CPUFloatType]{4,1} ]

Can you help me understand this error message and what I am doing wrong.
Thanks