| 240 | } |
| 241 | |
| 242 | Status BindGenericInputs(const GenericSignature& signature, |
| 243 | const std::vector<std::pair<string, Tensor>>& inputs, |
| 244 | std::vector<std::pair<string, Tensor>>* bound_inputs) { |
| 245 | const protobuf::Map<string, serving::TensorBinding>& bindings = |
| 246 | signature.map(); |
| 247 | |
| 248 | for (const auto& entry : inputs) { |
| 249 | const auto mapped = bindings.find(entry.first); |
| 250 | if (mapped == bindings.end()) { |
| 251 | return errors::NotFound( |
| 252 | strings::StrCat("Could not find generic binding for: ", entry.first)); |
| 253 | } |
| 254 | bound_inputs->push_back({mapped->second.tensor_name(), entry.second}); |
| 255 | } |
| 256 | return Status::OK(); |
| 257 | } |
| 258 | |
| 259 | Status BindGenericNames(const GenericSignature& signature, |
| 260 | const std::vector<string>& input_names, |