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

Method stopTraining

tfjs-layers/src/models.ts:1076–1085  ·  view source on GitHub ↗

* Setter used for force stopping of LayersModel.fit() (i.e., training). * * Example: * * ```js * const model = tf.sequential(); * model.add(tf.layers.dense({units: 1, inputShape: [10]})); * model.compile({loss: 'meanSquaredError', optimizer: 'sgd'}); * const xs = tf.ones([8,

(stop: boolean)

Source from the content-addressed store, hash-verified

1074 * ```
1075 */
1076 override set stopTraining(stop: boolean) {
1077 // TODO(cais): When refactoring to remove the composition pattern happens,
1078 // remove this method overriding.
1079 if (this.model == null) {
1080 throw new ValueError(
1081 'Cannot set the stopTraining property of a sequential model before ' +
1082 'it is compiled.');
1083 }
1084 this.model.stopTraining = stop;
1085 }
1086
1087 override get stopTraining(): boolean {
1088 if (this.model == null) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected