server-json/node_modules/tfjs-image-recognition-base/build/es6/common/extractWeightEntryFactory.js
2024-11-01 08:00:42 +00:00

12 lines
No EOL
592 B
JavaScript

import { isTensor } from '../utils';
export function extractWeightEntryFactory(weightMap, paramMappings) {
return function (originalPath, paramRank, mappedPath) {
var tensor = weightMap[originalPath];
if (!isTensor(tensor, paramRank)) {
throw new Error("expected weightMap[" + originalPath + "] to be a Tensor" + paramRank + "D, instead have " + tensor);
}
paramMappings.push({ originalPath: originalPath, paramPath: mappedPath || originalPath });
return tensor;
};
}
//# sourceMappingURL=extractWeightEntryFactory.js.map