2020-08-20 02:05:34 +02:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.extractWeightEntryFactory = void 0;
|
|
|
|
const utils_1 = require("../utils");
|
|
|
|
function extractWeightEntryFactory(weightMap, paramMappings) {
|
2020-08-18 14:04:33 +02:00
|
|
|
return function (originalPath, paramRank, mappedPath) {
|
|
|
|
const tensor = weightMap[originalPath];
|
2020-08-20 02:05:34 +02:00
|
|
|
if (!utils_1.isTensor(tensor, paramRank)) {
|
2020-08-18 14:04:33 +02:00
|
|
|
throw new Error(`expected weightMap[${originalPath}] to be a Tensor${paramRank}D, instead have ${tensor}`);
|
|
|
|
}
|
|
|
|
paramMappings.push({ originalPath, paramPath: mappedPath || originalPath });
|
|
|
|
return tensor;
|
|
|
|
};
|
|
|
|
}
|
2020-08-20 02:05:34 +02:00
|
|
|
exports.extractWeightEntryFactory = extractWeightEntryFactory;
|
2020-08-18 14:04:33 +02:00
|
|
|
//# sourceMappingURL=extractWeightEntryFactory.js.map
|