* Push a new dictionary of gradients into records. * * @param {{[varName: string]: tf.Tensor[]}} record The record of variable * gradient: a map from variable name to the Array of gradient values for * the variable. * @param {{[varName: string]: tf.Tensor}} gradients The new gradi
(record, gradients)
| 235 | * into `record`: a map from variable name to the gradient Tensor. |
| 236 | */ |
| 237 | pushGradients(record, gradients) { |
| 238 | for (const key in gradients) { |
| 239 | if (key in record) { |
| 240 | record[key].push(gradients[key]); |
| 241 | } else { |
| 242 | record[key] = [gradients[key]]; |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | // The IndexedDB path where the model of the policy network will be saved. |