Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
console.log(`Boolean flag log = ${log}`);
const taskType = 'model';
let environmentInfo: EnvironmentInfo;
if (isNodeJS) {
environmentInfo = common.getNodeEnvironmentInfo(tfn);
} else {
environmentInfo = common.getBrowserEnvironmentInfo();
}
const versionSet: VersionSet = isNodeJS ? {versions: tfn.version} : {
versions: {
'tfjs-converter': tfconverter.version_converter,
'tfjs-core': tfc.version_core,
'tfjs-data': tfd.version_data,
'tfjs-layers': tfl.version_layers
}
};
let suiteLog: common.SuiteLog;
if (isNodeJS) {
// tslint:disable-next-line:no-require-imports
const fs = require('fs');
suiteLog = JSON.parse(fs.readFileSync(BENCHMARKS_JSON_PATH, 'utf-8'));
} else {
suiteLog =
await (await fetch(BENCHMARKS_JSON_URL)).json() as common.SuiteLog;
}
const pyEnvironmentInfo = suiteLog.environmentInfo;
const pyEnvironmentId =
log ? await addEnvironmentInfoToFirestore(pyEnvironmentInfo) : null;
environmentInfo.systemInfo = pyEnvironmentInfo.systemInfo;
*/
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("@tensorflow/tfjs-core"));
__export(require("@tensorflow/tfjs-layers"));
__export(require("@tensorflow/tfjs-converter"));
// Import versions of all sub-packages.
var tfjs_core_1 = require("@tensorflow/tfjs-core");
var tfjs_layers_1 = require("@tensorflow/tfjs-layers");
var tfjs_converter_1 = require("@tensorflow/tfjs-converter");
var version_1 = require("./version");
exports.version = {
'tfjs-core': tfjs_core_1.version_core,
'tfjs-layers': tfjs_layers_1.version_layers,
'tfjs-converter': tfjs_converter_1.version_converter,
'tfjs': version_1.version
};
//# sourceMappingURL=index.js.map
}, function(modId) {var map = {"./version":1557782889909}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1557782889909, function(require, module, exports) {
const input3 = tfl.input({shape: [30]});
const reshaped1 = tfl.layers.reshape({targetShape: [10]}).apply(input1);
const reshaped2 = tfl.layers.reshape({targetShape: [20]}).apply(input2);
const dense1 = tfl.layers.dense({units: 5}).apply(reshaped1);
const dense2 = tfl.layers.dense({units: 5}).apply(reshaped2);
const dense3 = tfl.layers.dense({units: 5}).apply(input3);
const avg = tfl.layers.average().apply([dense1, dense2]);
const concat = tfl.layers.concatenate({axis: -1}).apply([avg, dense3]);
const output = tfl.layers.dense({units: 1}).apply(concat);
const model = tfl.model({inputs: [input1, input2, input3], outputs: output});
await saveModelAndRandomInputsAndOutputs(model, exportPath);
}
console.log(`Using tfjs-core version: ${tfc.version_core}`);
console.log(`Using tfjs-layers version: ${tfl.version_layers}`);
console.log(`Using tfjs-node version: ${tfjsNode.version}`);
if (process.argv.length !== 3) {
throw new Error('Usage: node tfjs_save.ts ');
}
const testDataDir = process.argv[2];
(async function() {
await exportMLPModel(join(testDataDir, 'mlp'));
await exportCNNModel(join(testDataDir, 'cnn'));
await exportDepthwiseCNNModel(join(testDataDir, 'depthwise_cnn'));
await exportSimpleRNNModel(join(testDataDir, 'simple_rnn'));
await exportGRUModel(join(testDataDir, 'gru'));
await exportBidirectionalLSTMModel(join(testDataDir, 'bidirectional_lstm'));
await exportTimeDistributedLSTMModel(
join(testDataDir, 'time_distributed_lstm'));
const input3 = tfl.input({shape: [30]});
const reshaped1 = tfl.layers.reshape({targetShape: [10]}).apply(input1);
const reshaped2 = tfl.layers.reshape({targetShape: [20]}).apply(input2);
const dense1 = tfl.layers.dense({units: 5}).apply(reshaped1);
const dense2 = tfl.layers.dense({units: 5}).apply(reshaped2);
const dense3 = tfl.layers.dense({units: 5}).apply(input3);
const avg = tfl.layers.average().apply([dense1, dense2]);
const concat = tfl.layers.concatenate({axis: -1}).apply([avg, dense3]);
const output = tfl.layers.dense({units: 1}).apply(concat);
const model = tfl.model({inputs: [input1, input2, input3], outputs: output});
await saveModelAndRandomInputsAndOutputs(model, exportPath);
}
console.log(`Using tfjs-core version: ${tfc.version_core}`);
console.log(`Using tfjs-layers version: ${tfl.version_layers}`);
console.log(`Using tfjs-node version: ${JSON.stringify(tfjsNode.version)}`);
if (process.argv.length !== 3) {
throw new Error('Usage: node tfjs_save.ts ');
}
const testDataDir = process.argv[2];
(async function() {
await exportMLPModel(join(testDataDir, 'mlp'));
await exportCNNModel(join(testDataDir, 'cnn'));
await exportDepthwiseCNNModel(join(testDataDir, 'depthwise_cnn'));
await exportSimpleRNNModel(join(testDataDir, 'simple_rnn'));
await exportGRUModel(join(testDataDir, 'gru'));
await exportBidirectionalLSTMModel(join(testDataDir, 'bidirectional_lstm'));
await exportTimeDistributedLSTMModel(
join(testDataDir, 'time_distributed_lstm'));
export function setMetadata(metadata) {
document.getElementById('benchmark-timestamp').textContent = new Date().toISOString();
document.getElementById('navigator-userAgent').textContent = navigator.userAgent;
document.getElementById('pyKerasVersion').textContent = metadata.keras_version;
document.getElementById('tfVersion').textContent = metadata.tensorflow_version;
document.getElementById('tfUsesGPU').textContent = metadata.tensorflow_uses_gpu;
document.getElementById('tfjs-core-version').textContent = tfc.version_core;
document.getElementById('tfjs-layers-version').textContent = tfl.version_layers;
}