()
| 80 | |
| 81 | // Common predict function for MobileNetV3 and MobileNetV2Lite |
| 82 | function commonMobileNetPredictFunc() { |
| 83 | const input = tf.randomNormal([1, 224, 224, 3]); |
| 84 | const inputData = input.dataSync(); |
| 85 | if (typeof isTflite === 'function' && isTflite()) { |
| 86 | return async () => { |
| 87 | // Do copy from 'inputData' in each predict as its buffer |
| 88 | // will be detached after transferring to worker. |
| 89 | const input = inputData.slice(0); |
| 90 | return await tfliteModel.predict( |
| 91 | Comlink.transfer(input, [input.buffer])); |
| 92 | }; |
| 93 | } else { |
| 94 | return predictFunction(input); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | const benchmarks = { |
| 99 | 'MobileNetV3': { |
nothing calls this directly
no test coverage detected
searching dependent graphs…