Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yinggeh committed Jul 26, 2024
1 parent e6c7cb9 commit 182f6ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libtorch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,6 @@ SetStringInputTensor(
cudaStream_t stream, const char* host_policy_name)
{
bool cuda_copy = false;
size_t element_idx = 0;

// For string data type, we always need to have the data on CPU so
// that we can read string length and construct the string
Expand All @@ -1926,7 +1925,7 @@ SetStringInputTensor(
stream, &cuda_copy);
if (err != nullptr) {
RESPOND_AND_SET_NULL_IF_ERROR(response, err);
FillStringTensor(input_list, request_element_cnt - element_idx);
FillStringTensor(input_list, request_element_cnt);
return cuda_copy;
}

Expand All @@ -1945,9 +1944,10 @@ SetStringInputTensor(
input_list->push_back(std::string(addr, len));
}

size_t element_cnt = str_list.size();
if (err != nullptr) {
RESPOND_AND_SET_NULL_IF_ERROR(response, err);
FillStringTensor(input_list, request_element_cnt - element_idx);
FillStringTensor(input_list, request_element_cnt - element_cnt);
}
return cuda_copy;
}
Expand Down

0 comments on commit 182f6ad

Please sign in to comment.