Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
`dLoss = ${dLoss[0].toFixed(6)}, gLoss = ${gLoss[0].toFixed(6)}`);
if (logWriter != null) {
logWriter.scalar('dLoss', dLoss[0], step);
logWriter.scalar('gLoss', gLoss[0], step);
step++;
}
// Assert on no memory leak.
// TODO(cais): Remove this check once the current memory leak in
// tfjs-node and tfjs-node-gpu is fixed.
if (numTensors == null) {
numTensors = tf.memory().numTensors;
} else {
tf.util.assert(
tf.memory().numTensors === numTensors,
`Leaked ${tf.memory().numTensors - numTensors} tensors`);
}
}
await generator.save(saveURL);
console.log(
`epoch ${epoch + 1} elapsed time: ` +
`${((tf.util.now() - tBatchBegin) / 1e3).toFixed(1)} s`);
console.log(`Saved generator model to: ${saveURL}\n`);
}
// Write metadata to disk to indicate the end of the training.
fs.writeFileSync(
metadataPath,
JSON.stringify(makeMetadata(args.epochs, args.epochs, true)));
}
console.log(
`epoch ${epoch + 1}/${args.epochs} batch ${batch + 1}/${
numBatches}: ` +
`dLoss = ${dLoss[0].toFixed(6)}, gLoss = ${gLoss[0].toFixed(6)}`);
if (logWriter != null) {
logWriter.scalar('dLoss', dLoss[0], step);
logWriter.scalar('gLoss', gLoss[0], step);
step++;
}
// Assert on no memory leak.
// TODO(cais): Remove this check once the current memory leak in
// tfjs-node and tfjs-node-gpu is fixed.
if (numTensors == null) {
numTensors = tf.memory().numTensors;
} else {
tf.util.assert(
tf.memory().numTensors === numTensors,
`Leaked ${tf.memory().numTensors - numTensors} tensors`);
}
}
await generator.save(saveURL);
console.log(
`epoch ${epoch + 1} elapsed time: ` +
`${((tf.util.now() - tBatchBegin) / 1e3).toFixed(1)} s`);
console.log(`Saved generator model to: ${saveURL}\n`);
}
// Write metadata to disk to indicate the end of the training.
fs.writeFileSync(