MnaNode
Namespace: MNALIB · Library: MNA Library
#include <mna/mna_node.h>
struct MNALIB::MnaNode
One operation in the computational graph.
Single executable step in an MNA pipeline graph, with attributes, typed ports, exec mode, verification and provenance.
src/examples/ex_mna/main.cpp
MnaGraph graph;
MnaNode source;
source.id = "source";
source.opType = "ex_constant";
source.attributes["value"] = 3.0;
const MnaPort sourceOut = port("out", MnaPortDir::Output); // name, data kind, direction
source.outputs.append(sourceOut);
graph.addNode(source);
for (const QString& id : {QStringLiteral("scale"), QStringLiteral("shift")}) {
MnaNode node;
node.id = id;
node.opType = "ex_affine";
node.inputs.append(port("in", MnaPortDir::Input));
node.outputs.append(port("out", MnaPortDir::Output));
graph.addNode(node);
}
graph.node("scale").attributes["gain"] = 2.0;
graph.connect("source", "out", "scale", "in");
graph.connect("scale", "out", "shift", "in");
Public Methods
toJson()
toCbor()
Static Methods
fromJson(json)
fromCbor(cbor)
Example
- Full source:
src/examples/ex_mna/main.cpp - Build target:
ex_mna(runs under CTest)
Used in examples
ex_mna
MNA library: register operations, build and run a graph, bind parameters and save a project.
src/examples/ex_mna/main.cpp, line 115
MnaGraph graph;
MnaNode source;
source.id = "source";
source.opType = "ex_constant";
source.attributes["value"] = 3.0;
const MnaPort sourceOut = port("out", MnaPortDir::Output); // name, data kind, direction
source.outputs.append(sourceOut);
graph.addNode(source);
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>