source.append();
- source.append("const char *", name, "_input_name(const ", name,
- " *net, unsigned n) { assert(\"NYI\"); }");
- source.append("unsigned ", name, "_input_rank(const ", name,
- " *net, unsigned n) { assert(\"NYI\"); }");
- source.append("unsigned ", name, "_input_dim(const ", name,
- " *net, unsigned n, unsigned axis) { assert(\"NYI\"); }");
+ // Emit Network_input_name function
+ source.append("const char *", name, "_input_name(const ", name, " *net, unsigned n) {");
+ source.indent();
+ source.append("return net->inputs.at(n).name;");
+ source.unindent();
+ source.append("}");
+
+ // Emit Network_input_rank function
+ source.append("unsigned ", name, "_input_rank(const ", name, " *net, unsigned n) {");
+ source.indent();
+ source.append("return net->inputs.at(n).shape.rank;");
+ source.unindent();
+ source.append("}");
+
+ // Emit Network_input_dim function
+ source.append("unsigned ", name, "_input_dim(const ", name, " *net, unsigned n, unsigned axe)");
+ source.append("{");
+ source.indent();
+ source.append("return net->inputs.at(n).shape.dims[axe];");
+ source.unindent();
+ source.append("}");
// Emit Network_input_bind function
source.append("void ", name, "_input_bind(", name,
source.append();
- source.append("const char *", name, "_output_name(const ", name,
- " *net, unsigned n) { assert(\"NYI\"); }");
- source.append("unsigned ", name, "_output_rank(const ", name,
- " *net, unsigned n) { assert(\"NYI\"); }");
- source.append("unsigned ", name, "_output_dim(const ", name,
- " *net, unsigned n, unsigned axis) { assert(\"NYI\"); }");
+ // Emit Network_output_name function
+ source.append("const char *", name, "_output_name(const ", name, " *net, unsigned n) {");
+ source.indent();
+ source.append("return net->outputs.at(n).name;");
+ source.unindent();
+ source.append("}");
+
+ // Emit Network_output_rank function
+ source.append("unsigned ", name, "_output_rank(const ", name, " *net, unsigned n) {");
+ source.indent();
+ source.append("return net->outputs.at(n).shape.rank;");
+ source.unindent();
+ source.append("}");
+
+ // Emit Network_output_dim function
+ source.append("unsigned ", name, "_output_dim(const ", name, " *net, unsigned n, unsigned axe)");
+ source.append("{");
+ source.indent();
+ source.append("return net->outputs.at(n).shape.dims[axe];");
+ source.unindent();
+ source.append("}");
// Emit Network_output_bind function
source.append("void ", name, "_output_bind(", name,