Input 1D array with float datatype in C++
I would like to input row = [0.160625, 0.967468297, 3.520480583, 0.862454481, -0.341933766] as entry which is float type and pass it to forward module. I used python trying to translate to C++,
I got syntax error. Support needed. Thanks!
    // run not okay
    // Create a vector of inputs.
    std::vector&lt;torch::jit::IValue&gt; inputs;
    row = [0.190625, 0.957468297, 4.520480583, 0.962454481, -0.241933766]
    inputs.push_back(torch::tensor(row));

    // Execute the model and turn its output into a tensor.
    at::Tensor output = module.forward(inputs).toTensor();
    std::cout &lt;&lt; output.slice(/*dim=*/1, /*start=*/0, /*end=*/4) &lt;&lt; '\n';

I would like to use row as instance and get the output.
When I use dummy values such as torch::one({1, 5}), the app run ok.
However, when I passed the real value as row - the float array, the app is aborted.
    // run ok for this case 
    // Create a vector of inputs.
    std::vector&lt;torch::jit::IValue&gt; inputs;
    inputs.push_back(torch::ones({ 1, 5}));

    // Execute the model and turn its output into a tensor.
    at::Tensor output = module.forward(inputs).toTensor();
    std::cout &lt;&lt; output.slice(/*dim=*/1, /*start=*/0, /*end=*/4) &lt;&lt; '\n';


Did you try replacing [] with {} as mentioned before?
float row[] = { 0.190625, 0.957468297, 4.520480583, 0.962454481, -0.241933766 };

