Replies: 1 comment
-
(probably stale, but replying just in case) My guess is your input_dims has the batch_size in it, and your vector of input_ids is only max_seq_length. So this only works for a batch size of 1 where these match. You need a single vector (not a vector of vectors) to store your input ids as the memory must be contiguous. Then the size needs to match the shape of the tensor you're creating. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
std::vector<std::vector<int64_t>> input_ids(batch_size, std::vector<int64_t>(max_seq_length));
I have specified batch_size and max_seq_length.
for(int i=0; i < batch_size; i++){ Ort::Value input_tensor = Ort::Value::CreateTensor<int64_t>(memory_info, input_ids[i].data(), input_ids[i].size(), input_dims.data(), input_dims.size()); input_tensors.push_back(std::move(input_tensor)); }
I'm using a loop to add data from input_ids to the input_tensors container by creating a tensor that matches the dimensional requirements, but I always get the following error when creating it.
terminate called after throwing an instance of 'Ort::Exception' what(): not enough space: expected 48, got 24 Aborted
When I specify batch_size to be 1, the above error is not generated, once batch_size is not 1, an error message is reported.
Thanks you.
Beta Was this translation helpful? Give feedback.
All reactions