Skip to content

Commit 4d469a9

Browse files
authored
refactor: Refactor string input checks (#370)
Refactor string input tensor checks
1 parent 2b12abe commit 4d469a9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/python_be.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,15 @@ ModelInstanceState::GetInputTensor(
424424
RETURN_IF_ERROR(backend::ReadInputTensor(
425425
request, input_name, input_buffer, &byte_size));
426426
}
427+
428+
if (input_dtype == TRITONSERVER_TYPE_BYTES) {
429+
const char* content = reinterpret_cast<char*>(input_tensor->DataPtr());
430+
size_t content_byte_size = input_tensor->ByteSize();
431+
const size_t request_element_cnt = GetElementCount(input_tensor->Dims());
432+
RETURN_IF_ERROR(ValidateStringBuffer(
433+
content, content_byte_size, request_element_cnt, input_name,
434+
nullptr /* str_list */));
435+
}
427436
} else {
428437
#ifdef TRITON_ENABLE_GPU
429438
// Attempt to use the cuda shared memory pool for GPU tensor.

0 commit comments

Comments
 (0)