Expected Tensor but got Tuple

When using pytorch to process LSTM in C++, after putting the hidden layer and input together into the forward function, an error is reported:terminate called after throwing an instance of ‘c10::Error’
what(): Expected Tensor but got Tuple
Exception raised from reportToTensorTypeError at …/aten/src/ATen/core/ivalue.cpp:968 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x57 (0x7fd8c2ee1617 in /home/zjliu/demo_cuda/libtorch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x64 (0x7fd8c2e9c98d in /home/zjliu/demo_cuda/libtorch/lib/libc10.so)
frame #2: c10::IValue::reportToTensorTypeError() const + 0x58 (0x7fd8a75d6a38 in /home/zjliu/demo_cuda/libtorch/lib/libtorch_cpu.so)
frame #3: ./example-app() [0x40adf6]
frame #4: ./example-app() [0x406d11]
frame #5: __libc_start_main + 0xf5 (0x7fd855c8b555 in /lib64/libc.so.6)
frame #6: ./example-app() [0x405569]

This is the code:

 torch::Tensor hn1 = torch::zeros({1, 10}).to(device);
        torch::Tensor hn2 = torch::zeros({1, 5}).to(device);
        torch::Tensor hn3 = torch::zeros({1, 1}).to(device);
        torch::Tensor cn1 = torch::zeros({1, 10}).to(device);
        torch::Tensor cn2 = torch::zeros({1, 5}).to(device);
        torch::Tensor cn3 = torch::zeros({1, 1}).to(device);

   

            std::vector<float> input_data_values = input_data_values_matrix[i];

            torch::Tensor input_data = torch::from_blob(input_data_values.data(), {1, 1, 40}).to(torch::kFloat32).to(device);



            std::vector<torch::jit::IValue> inputs;


            inputs.push_back(input_data.to(device));
            inputs.push_back(hn1);
            inputs.push_back(cn1);
            inputs.push_back(hn2);
            inputs.push_back(cn2);
            inputs.push_back(hn3);
            inputs.push_back(cn3);

     
             torch::Tensor output  = module.forward(inputs).toTensor(); //error code

please tell me how to solve it