| 30 | |
| 31 | namespace { |
| 32 | void checkCompiledScript(const CompilationUnit& compilation_unit) { |
| 33 | auto& fn = *bytedance::bolt::torch::get_function(compilation_unit); |
| 34 | // The torch script function must take only one input and yield one output. |
| 35 | { |
| 36 | if (fn.num_inputs() != 1) { |
| 37 | BOLT_FAIL(fmt::format( |
| 38 | "Torch script function {} must take exactly one input. (num inputs: {})", |
| 39 | fn.name(), |
| 40 | fn.num_inputs())); |
| 41 | } |
| 42 | |
| 43 | const ::c10::FunctionSchema& fn_schema = fn.getSchema(); |
| 44 | const std::vector<::c10::Argument>& returns = fn_schema.returns(); |
| 45 | if (returns.size() != 1) { |
| 46 | BOLT_FAIL(fmt::format( |
| 47 | "Torch script function {} must return exactly one input. (num outputs: {})", |
| 48 | fn.name(), |
| 49 | returns.size())); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | } // namespace |
| 55 |
no test coverage detected