MCPcopy Index your code
hub / github.com/tensorflow/tfjs / exportFunctionalMergeModel

Function exportFunctionalMergeModel

e2e/integration_tests/create_save_predict.js:203–218  ·  view source on GitHub ↗
(exportPath)

Source from the content-addressed store, hash-verified

201
202// Functional model with two Merge layers.
203async function exportFunctionalMergeModel(exportPath) {
204 const input1 = tfl.input({shape: [2, 5]});
205 const input2 = tfl.input({shape: [4, 5]});
206 const input3 = tfl.input({shape: [30]});
207 const reshaped1 = tfl.layers.reshape({targetShape: [10]}).apply(input1);
208 const reshaped2 = tfl.layers.reshape({targetShape: [20]}).apply(input2);
209 const dense1 = tfl.layers.dense({units: 5}).apply(reshaped1);
210 const dense2 = tfl.layers.dense({units: 5}).apply(reshaped2);
211 const dense3 = tfl.layers.dense({units: 5}).apply(input3);
212 const avg = tfl.layers.average().apply([dense1, dense2]);
213 const concat = tfl.layers.concatenate({axis: -1}).apply([avg, dense3]);
214 const output = tfl.layers.dense({units: 1}).apply(concat);
215 const model = tfl.model({inputs: [input1, input2, input3], outputs: output});
216
217 await saveModelAndRandomInputs(model, exportPath);
218}
219
220console.log(`Using tfjs-core version: ${tfc.version_core}`);
221console.log(`Using tfjs-layers version: ${tfl.version_layers}`);

Callers 1

Calls 3

saveModelAndRandomInputsFunction · 0.85
reshapeMethod · 0.80
applyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…