| 1104 | } |
| 1105 | |
| 1106 | TRITONTF_Error* |
| 1107 | TRITONTF_ModelMakeCallable( |
| 1108 | TRITONTF_Model* model, const char** input_names, |
| 1109 | const TRITONTF_DataType* input_types, const size_t num_inputs, |
| 1110 | const char** output_names, const TRITONTF_DataType* output_types, |
| 1111 | const size_t num_outputs) |
| 1112 | { |
| 1113 | ModelImpl* m = reinterpret_cast<ModelImpl*>(model); |
| 1114 | |
| 1115 | const auto& device_name = m->DeviceName(); |
| 1116 | if (device_name.empty()) { |
| 1117 | return TRITONTF_ErrorNew( |
| 1118 | "model session does not have an assigned GPU device"); |
| 1119 | } |
| 1120 | |
| 1121 | tensorflow::CallableOptions opts; |
| 1122 | for (size_t i = 0; i < num_inputs; ++i) { |
| 1123 | const std::string input_name = input_names[i]; |
| 1124 | opts.add_feed(input_name); |
| 1125 | if (IsGPUFeedAndFetchSupported(input_types[i])) { |
| 1126 | opts.mutable_feed_devices()->insert({input_name, device_name}); |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | for (size_t i = 0; i < num_outputs; ++i) { |
| 1131 | const std::string output_name = output_names[i]; |
| 1132 | opts.add_fetch(output_name); |
| 1133 | if (IsGPUFeedAndFetchSupported(output_types[i])) { |
| 1134 | opts.mutable_fetch_devices()->insert({output_name, device_name}); |
| 1135 | } |
| 1136 | } |
| 1137 | |
| 1138 | // CallableOptions.fetch_skip_sync = false is not yet implemented, we |
| 1139 | // will have to synchronize after the callable is run. |
| 1140 | opts.set_fetch_skip_sync(true); |
| 1141 | |
| 1142 | return m->MakeCallable(opts); |
| 1143 | } |
| 1144 | |
| 1145 | TRITONTF_Error* |
| 1146 | TRITONTF_ModelRun( |
nothing calls this directly
no test coverage detected