Skip to content

How to set up inputTensor when deploying multi-input model using c++? #21593

Closed Answered by Shyuna
Shyuna asked this question in API Q&A
Discussion options

You must be logged in to vote
std::array<int64_t, 2> input_shape_{1, static_cast<int64_t>(input_ids.size())};

std::vector<Ort::Value> input_tensors;
input_tensors.push_back(Ort::Value::CreateTensor<int64_t>(
    memoryInfo, input_ids.data(), input_ids.size(), input_shape_.data(), input_shape_.size()));
input_tensors.push_back(
    Ort::Value::CreateTensor<int64_t>(memoryInfo, attention_mask.data(), attention_mask.size(),
                                      input_shape_.data(), input_shape_.size()));
input_tensors.push_back(
    Ort::Value::CreateTensor<int64_t>(memoryInfo, token_type_ids.data(), token_type_ids.size(),
                                      input_shape_.data(), input_shape_.size()));

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Shyuna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
API Q&A
Labels
None yet
1 participant