@hoff97/tensor-js
Version:
PyTorch like deep learning inferrence library
11 lines • 351 B
JavaScript
import { pool } from './pool';
export function reduceMean(a, axes, keepDims) {
let poolSize = 1;
for (let i = 0; i < axes.length; i++) {
poolSize *= a.shape[axes[i]];
}
return pool(a, axes, (a, b) => {
return a + (b !== undefined ? b : 0);
}, keepDims, (a) => a / poolSize);
}
//# sourceMappingURL=reduceMean.js.map