Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return tfc.tidy(() => {
let xs: tfc.Tensor|tfc.Tensor[] = [];
for (const input of model.inputs) {
xs.push(tfc.randomUniform([batchSize].concat(input.shape.slice(1))));
}
if (xs.length === 1) {
xs = xs[0];
}
let ys: tfc.Tensor|tfc.Tensor[] = [];
if (model instanceof tfl.LayersModel) {
for (const output of model.outputs) {
ys.push(tfc.randomUniform([batchSize].concat(output.shape.slice(1))));
}
if (ys.length === 1) {
ys = ys[0];
}
}
return {xs, ys};
});
}