(x)
| 91 | |
| 92 | // Predict the digit number from a batch of input images. |
| 93 | export function predict(x) { |
| 94 | const pred = tf.tidy(() => { |
| 95 | const axis = 1; |
| 96 | return model(x).argMax(axis); |
| 97 | }); |
| 98 | return Array.from(pred.dataSync()); |
| 99 | } |
| 100 | |
| 101 | // Given a logits or label vector, return the class indices. |
| 102 | export function classesFromLabel(y) { |
no test coverage detected