(inputTensor)
| 179 | } |
| 180 | |
| 181 | getGradientsAndSaveActions(inputTensor) { |
| 182 | const f = () => tf.tidy(() => { |
| 183 | const [logits, actions] = this.getLogitsAndActions(inputTensor); |
| 184 | this.currentActions_ = actions.dataSync(); |
| 185 | const labels = |
| 186 | tf.sub(1, tf.tensor2d(this.currentActions_, actions.shape)); |
| 187 | return tf.losses.sigmoidCrossEntropy(labels, logits).asScalar(); |
| 188 | }); |
| 189 | return tf.variableGrads(f); |
| 190 | } |
| 191 | |
| 192 | getCurrentActions() { |
| 193 | return this.currentActions_; |