MCPcopy
hub / github.com/tensorflow/tfjs / predictOnBatch

Method predictOnBatch

tfjs-layers/src/engine/training.ts:1137–1143  ·  view source on GitHub ↗

* Returns predictions for a single batch of samples. * * ```js * const model = tf.sequential({ * layers: [tf.layers.dense({units: 1, inputShape: [10]})] * }); * model.predictOnBatch(tf.ones([8, 10])).print(); * ``` * @param x: Input samples, as a Tensor (for models with exa

(x: Tensor|Tensor[])

Source from the content-addressed store, hash-verified

1135 * @doc {heading: 'Models', subheading: 'Classes'}
1136 */
1137 predictOnBatch(x: Tensor|Tensor[]): Tensor|Tensor[] {
1138 checkInputData(x, this.inputNames, this.feedInputShapes, true);
1139 // TODO(cais): Take care of the learning_phase boolean flag.
1140 // if (this.useLearningPhase) ...
1141 const batchSize = (Array.isArray(x) ? x[0] : x).shape[0];
1142 return this.predictLoop(x, batchSize);
1143 }
1144
1145 protected standardizeUserDataXY(
1146 x: Tensor|Tensor[]|{[inputName: string]: Tensor},

Callers

nothing calls this directly

Calls 2

predictLoopMethod · 0.95
checkInputDataFunction · 0.85

Tested by

no test coverage detected