MCPcopy Create free account
hub / github.com/ai-techsystems/deepC / write

Method write

src/codegen/cppCodeGen.cpp:32–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include <unistd.h>
31
32bool dnnc::cppCodeGen::write() {
33
34 inferDataType typeInference(_graph);
35 typeInference.main();
36
37 std::string code = "";
38
39 for (dnnParameters param : _graph.parameters()) {
40 code += write(param);
41 }
42 size_t argv_index = 1;
43 for (ioNode *term : _graph.inputs()) {
44 code += write(*term, argv_index);
45 }
46
47 for (node *n : _graph) {
48 if (n->ntype() == node::OPERATOR)
49 code += write(*dynamic_cast<opNode *>(n));
50 }
51
52 // OUTPUTs are written with operators.
53
54 std::ofstream out(_bundleDir.size()
55 ? (_bundleDir + FS_PATH_SEPARATOR + _outFile)
56 : _outFile);
57 if (!out.is_open() || out.fail()) {
58 std::cerr << "ERROR (CODEGEN): could not open file " + _outFile +
59 " to write.\n";
60 return false;
61 }
62 out << writeIncludes() << "\n";
63 out << writeUsageFunction() << "\n";
64 out << writeMainFunction(code) << "\n";
65 out.close();
66 return code.length();
67}
68
69// \brief replace all characters that can't appear
70// in C++ variable name.

Callers 11

relicense.pyFile · 0.45
mainFunction · 0.45
compileMethod · 0.45
mainMethod · 0.45
writeParamsToFileMethod · 0.45
write_imageFunction · 0.45
test_readAllOnnxFilesMethod · 0.45
execute.pyFile · 0.45
generate_onnx_runnerFunction · 0.45
create_testcaseFunction · 0.45
mainFunction · 0.45

Calls 15

getDNNC_DataTypeStrFunction · 0.85
getOpCodeStrFunction · 0.85
parametersMethod · 0.80
mainMethod · 0.45
inputsMethod · 0.45
ntypeMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45
nameMethod · 0.45
emptyMethod · 0.45
dtypeMethod · 0.45

Tested by 1

test_readAllOnnxFilesMethod · 0.36