@@ -54,12 +54,15 @@ CheckResponseSenderArguments(
5454
5555ResponseSender::ResponseSender (
5656 intptr_t request_address, intptr_t response_factory_address,
57- bool const * is_decoupled, std::unique_ptr<SharedMemoryManager>& shm_pool,
57+ bool const * is_decoupled,
58+ const std::set<std::string>& requested_output_names,
59+ std::unique_ptr<SharedMemoryManager>& shm_pool,
5860 const std::shared_ptr<PbCancel>& pb_cancel)
5961 : request_address_(request_address),
6062 response_factory_address_ (response_factory_address),
61- is_decoupled_(is_decoupled), shm_pool_(shm_pool), pb_cancel_(pb_cancel),
62- closed_(false ), number_of_response_sent_(0 )
63+ is_decoupled_(is_decoupled),
64+ requested_output_names_(requested_output_names), shm_pool_(shm_pool),
65+ pb_cancel_(pb_cancel), closed_(false ), number_of_response_sent_(0 )
6366{
6467}
6568
@@ -123,6 +126,9 @@ ResponseSender::Send(
123126
124127 CheckResponseSenderArguments (infer_response, flags);
125128 UpdateStateAndCounters (infer_response, flags);
129+ if (infer_response) {
130+ infer_response->PruneOutputTensors (requested_output_names_);
131+ }
126132
127133 std::unique_ptr<Stub>& stub = Stub::GetOrCreateInstance ();
128134
0 commit comments