* Get number of samples provided for training, evaluation or prediction. * * @param ins Input `tf.Tensor`. * @param batchSize Integer batch size, optional. * @param steps Total number of steps (batches of samples) before * declaring loop finished. Optional. * @param stepsName The p
(
ins: Tensor|Tensor[], batchSize?: number, steps?: number,
stepsName = 'steps')
| 902 | * @returns Number of samples provided. |
| 903 | */ |
| 904 | private checkNumSamples( |
| 905 | ins: Tensor|Tensor[], batchSize?: number, steps?: number, |
| 906 | stepsName = 'steps'): number { |
| 907 | let numSamples: number; |
| 908 | if (steps != null) { |
| 909 | numSamples = null; |
| 910 | if (batchSize != null) { |
| 911 | throw new ValueError( |
| 912 | `If ${stepsName} is set, batchSize must be null or undefined.` + |
| 913 | `Got batchSize = ${batchSize}`); |
| 914 | } |
| 915 | } else if (ins != null) { |
| 916 | if (Array.isArray(ins)) { |
| 917 | numSamples = ins[0].shape[0]; |
| 918 | } else { |
| 919 | numSamples = ins.shape[0]; |
| 920 | } |
| 921 | } else { |
| 922 | throw new ValueError( |
| 923 | `Either the input data should have a defined shape, or ` + |
| 924 | `${stepsName} shoud be specified.`); |
| 925 | } |
| 926 | return numSamples; |
| 927 | } |
| 928 | |
| 929 | /** |
| 930 | * Execute internal tensors of the model with input data feed. |
no outgoing calls
no test coverage detected