That’s right… I still get the error though.  Maybe it’s in the first var:
int n_features = feature_list.size();

    torch::Tensor state_tensor = torch::ones({n_features}, torch::requires_grad(requires_grad));

    for (int i = 0; i < n_features; i ++)
    {
        state_tensor[i] = feature_list[i].value;
    }

    return state_tensor;

Any chance you could be a bit clearer about the normal way to initialise a tensor with existing data though?
Ian