2020-08-20 02:10:42 +02:00
|
|
|
import { disposeUnusedWeightTensors, extractWeightEntryFactory } from '../common';
|
|
|
|
export function extractParamsFromWeigthMap(weightMap) {
|
2020-08-18 14:04:33 +02:00
|
|
|
const paramMappings = [];
|
2020-08-20 02:10:42 +02:00
|
|
|
const extractWeightEntry = extractWeightEntryFactory(weightMap, paramMappings);
|
2020-08-18 14:04:33 +02:00
|
|
|
function extractFcParams(prefix) {
|
|
|
|
const weights = extractWeightEntry(`${prefix}/weights`, 2);
|
|
|
|
const bias = extractWeightEntry(`${prefix}/bias`, 1);
|
|
|
|
return { weights, bias };
|
|
|
|
}
|
|
|
|
const params = {
|
|
|
|
fc: extractFcParams('fc')
|
|
|
|
};
|
2020-08-20 02:10:42 +02:00
|
|
|
disposeUnusedWeightTensors(weightMap, paramMappings);
|
2020-08-18 14:04:33 +02:00
|
|
|
return { params, paramMappings };
|
|
|
|
}
|
|
|
|
//# sourceMappingURL=extractParamsFromWeigthMap.js.map
|