29std::string getLabel(
const ComputationGraph& g,
const std::size_t i,
const bool includeLabels =
true) {
30 auto l = g.labels().find(i);
31 std::string label =
"v_" + std::to_string(i);
32 if (l != g.labels().end() && includeLabels) {
33 for (
auto tmp = l->second.begin(); tmp != l->second.end(); ++tmp) {
34 label = label + (tmp == l->second.begin() ?
"[" :
"") + *tmp +
35 (tmp != std::next(l->second.end(), -1) ?
";" :
"]");
44 const std::vector<T>& values,
const std::vector<T>& values2) {
46 std::ostringstream os;
48 for (std::size_t i = 0; i < g.
size(); ++i) {
50 os << i <<
"," << getLabel(g, i);
54 os << (opCodeLabels.size() > g.
opId(i) ? opCodeLabels[g.
opId(i)] :
"???") <<
"(";
55 for (std::size_t j = 0; j < g.
predecessors(i).size(); ++j) {
57 os << getLabel(g, p,
false) << (j < g.
predecessors(i).size() - 1 ?
";" :
"");
62 if (values.size() > i) {
63 os <<
"," << values[i];
66 if (values2.size() > i) {
67 os <<
"," << values2[i];
77 const std::vector<double>& values,
const std::vector<double>& values2);
79 const std::vector<RandomVariable>& values,
const std::vector<RandomVariable>& values2);
const std::vector< std::size_t > & predecessors(const std::size_t node) const
std::size_t opId(const std::size_t node) const
std::string ssaForm(const ComputationGraph &g, const std::vector< std::string > &opCodeLabels, const std::vector< T > &values, const std::vector< T > &values2)