@@ -191,9 +191,9 @@ InferContext::GetInputs()
191191{
192192 RequestRecord::RequestInput input{};
193193 for (const auto & request_input : infer_data_.valid_inputs_ ) {
194+ std::string data_type{request_input->Datatype ()};
194195 const uint8_t * buf{nullptr };
195196 size_t byte_size{0 };
196- std::string data_type{request_input->Datatype ()};
197197 request_input->RawData (&buf, &byte_size);
198198
199199 // The first 4 bytes of BYTES data is a 32-bit integer to indicate the size
@@ -213,17 +213,20 @@ InferContext::GetOutputs(const cb::InferResult& infer_result)
213213{
214214 RequestRecord::ResponseOutput output{};
215215 for (const auto & requested_output : infer_data_.outputs_ ) {
216+ std::string data_type{requested_output->Datatype ()};
216217 const uint8_t * buf{nullptr };
217218 size_t byte_size{0 };
218219 infer_result.RawData (requested_output->Name (), &buf, &byte_size);
220+
219221 // The first 4 bytes of BYTES data is a 32-bit integer to indicate the size
220222 // of the rest of the data (which we already know based on byte_size). It
221223 // should be ignored here, as it isn't part of the actual response
222- if (requested_output-> Datatype () == " BYTES" && byte_size >= 4 ) {
224+ if (data_type == " BYTES" && byte_size >= 4 ) {
223225 buf += 4 ;
224226 byte_size -= 4 ;
225227 }
226- output.emplace (requested_output->Name (), ResponseData (buf, byte_size));
228+ output.emplace (
229+ requested_output->Name (), RecordData (buf, byte_size, data_type));
227230 }
228231 return output;
229232}
0 commit comments