43 for (
auto &parsed_tensor : parsed_tensors)
48 if (!parsed_tensor->hasShape())
53 "Info you provided may be wrong or not enough. Please check the info file.");
55 parsed_tensor->mutable_shape().resize(shape.
rank());
56 for (
int r = 0; r < shape.
rank(); r++)
58 parsed_tensor->mutable_shape().dim(r) = shape.
dim(r);
61 _inputs.emplace_back(std::move(parsed_tensor));
64 _outputs.emplace_back(std::move(parsed_tensor));
85 auto actual_outputs = _tf_runner.
output();
87 for (
int n = 0; n < _outputs.size(); n++)
89 auto actual = actual_outputs[n];
90 const size_t byte_size = TF_TensorByteSize(actual);
91 const uint8_t *tf_data =
reinterpret_cast<const uint8_t *
>(TF_TensorData(actual));
93 const uint32_t shape_rank = TF_NumDims(actual);
94 _outputs[n]->mutable_shape().resize(shape_rank);
95 for (uint32_t r = 0; r < shape_rank; r++)
97 _outputs[n]->mutable_shape().dim(r) = TF_Dim(actual, r);
99 uint8_t *dest = _data_map.
allocate(_outputs[n].get());
101 std::memcpy(dest, tf_data, byte_size);