Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand All @@ -25,6 +25,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


import time

import numpy as np
import triton_python_backend_utils as pb_utils

Expand All @@ -38,13 +40,14 @@ def execute(self, requests):
for request in requests:
# Get input - number of responses to produce
in_tensor = pb_utils.get_input_tensor_by_name(request, "IN")
count = in_tensor.as_numpy()[0]
count = in_tensor.as_numpy().item()

response_sender = request.get_response_sender()
out_tensor = pb_utils.Tensor("OUT", np.array([[0.5]], dtype=np.float32))

# Produce 'count' responses, each with 0.5 as the output value
for i in range(count):
out_tensor = pb_utils.Tensor("OUT", np.array([0.5], dtype=np.float32))
time.sleep(0.1) # Simulate some processing delay
response = pb_utils.InferenceResponse(output_tensors=[out_tensor])
response_sender.send(response)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,7 +27,7 @@

name: "decoupled_producer"
backend: "python"
max_batch_size: 0
max_batch_size: 1

input [
{
Expand Down Expand Up @@ -55,4 +55,3 @@ instance_group [
model_transaction_policy {
decoupled: true
}

Loading
Loading