UNPKG

457 BJavaScriptView Raw
1import { reshape } from './reshape';
2export function xAs4D(x) {
3 let x4D;
4 if (x.rank === 0 || x.rank === 1) {
5 x4D = reshape(x, [1, 1, 1, x.size]);
6 }
7 else if (x.rank === 2) {
8 x4D = reshape(x, [1, 1, x.shape[0], x.shape[1]]);
9 }
10 else if (x.rank === 3) {
11 x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);
12 }
13 else {
14 x4D = x;
15 }
16 return x4D;
17}
18//# sourceMappingURL=batchnorm_util.js.map
\No newline at end of file