MCPcopy Index your code
hub / github.com/BrainJS/brain.js / matrixToString

Method matrixToString

src/recurrent/rnn-time-step.js:197–214  ·  view source on GitHub ↗
(m, stateIndex)

Source from the content-addressed store, hash-verified

195 }
196
197 function matrixToString(m, stateIndex) {
198 if (!m || !m.rows || !m.columns) return 'null';
199
200 if (m === model.input) return `json.input`;
201 if (m === model.outputConnector) return `json.outputConnector`;
202 if (m === model.output) return `json.output`;
203
204 for (let i = 0, max = model.hiddenLayers.length; i < max; i++) {
205 let hiddenLayer = model.hiddenLayers[i];
206 for (let p in hiddenLayer) {
207 if (!hiddenLayer.hasOwnProperty(p)) continue;
208 if (hiddenLayer[p] !== m) continue;
209 return `json.hiddenLayers[${ i }].${ p }`;
210 }
211 }
212
213 return matrixOrigin(m, stateIndex);
214 }
215
216 function toInner(fnString) {
217 // crude, but should be sufficient for now

Callers

nothing calls this directly

Calls 1

matrixOriginFunction · 0.85

Tested by

no test coverage detected