MCPcopy Create free account
hub / github.com/tensorflow/tfjs / stateful

Function stateful

tfjs-layers/src/engine/container.ts:1345–1360  ·  view source on GitHub ↗

* Determine whether the container is stateful. * * Porting Note: this is the equivalent of the stateful @property of * the Container class in PyKeras.

()

Source from the content-addressed store, hash-verified

1343 * the Container class in PyKeras.
1344 */
1345 override get stateful(): boolean {
1346 // Porting Note: This check is to prevent inadvertent setting of the
1347 // _stateful property of the Container instance.
1348 if (this._stateful) {
1349 throw new ValueError(
1350 'Container instance unexpectedly has _stateful = true. The ' +
1351 'statefulness of a Container is determined by the Layers it ' +
1352 'contains. Its _stateful property must remain the default false.');
1353 }
1354 for (const layer of this.layers) {
1355 if (layer.stateful) {
1356 return true;
1357 }
1358 }
1359 return false;
1360 }
1361
1362 /**
1363 * Reset the state of all stateful constituent layers (if any).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…