MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / pushGradients

Method pushGradients

cart-pole/index.js:237–245  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 1

trainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected