MCPcopy Create free account
hub / github.com/bytedance/bolt / checkCompiledScript

Function checkCompiledScript

bolt/torch/Utils.cpp:32–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31namespace {
32void 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

Callers 1

loadFunction · 0.85

Calls 4

get_functionFunction · 0.85
nameMethod · 0.45
getSchemaMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected