Skip to content

Commit e1699e0

Browse files
authored
Return appropriate error if the output is a scalar (triton-inference-server#28)
1 parent 968e80f commit e1699e0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libtorch.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,16 @@ ModelInstanceState::ReadOutputTensors(
942942
batchn_shape.push_back(*itr);
943943
}
944944

945+
if (batchn_shape.size() == 0) {
946+
RESPOND_ALL_AND_RETURN_IF_ERROR(
947+
responses, request_count,
948+
TRITONSERVER_ErrorNew(
949+
TRITONSERVER_ERROR_INVALID_ARG,
950+
(std::string("output '") + name +
951+
"' is a scalar which is not supported.")
952+
.c_str()));
953+
}
954+
945955
responder.ProcessTensor(
946956
name, output_dtype, batchn_shape, output_buffer,
947957
(device_.type() == torch::kCPU) ? TRITONSERVER_MEMORY_CPU

0 commit comments

Comments
 (0)