Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.criticOptimizer.minimize(() => {
// Compute Q targets for current states (y-i)
const qTargets = tf.add(rewards, tf.mul(tf.mul(gamma, qTargetsNext), tf.sub(1, dones)));
const qExpected = this.critic.predict([states, actions]);
const criticLoss = tf.losses.meanSquaredError(qExpected, qTargets);
// torch.nn.utils.clip_grad_norm_(self.critic.parameters(), 1)
return criticLoss;
});
// Actor update