| 168 | } |
| 169 | |
| 170 | string GetArrayCompassPt(const Model& model, const string& array_name) { |
| 171 | // The "compass point" is the point on the node where edge connections are |
| 172 | // made. For most arrays we don't care, but input's and outputs look better |
| 173 | // connected at the tip of the "house" and "invhouse" shapes used. So we |
| 174 | // append ":n" and ":s" respectively for those. |
| 175 | for (const auto& rnn_state : model.flags.rnn_states()) { |
| 176 | // RNN state is essentially an input |
| 177 | if (array_name == rnn_state.state_array()) { |
| 178 | return ":s"; |
| 179 | } |
| 180 | // RNN back-edge source is essentially an output |
| 181 | if (array_name == rnn_state.back_edge_source_array()) { |
| 182 | return ":n"; |
| 183 | } |
| 184 | } |
| 185 | if (IsInputArray(model, array_name)) { |
| 186 | return ":s"; |
| 187 | } |
| 188 | if (IsOutputArray(model, array_name)) { |
| 189 | return ":n"; |
| 190 | } |
| 191 | return ""; |
| 192 | } |
| 193 | |
| 194 | void AppendArrayVal(string* string, Array const& array, int index) { |
| 195 | if (array.buffer->type == ArrayDataType::kFloat) { |
no test coverage detected