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

Method constructor

snake-dqn/replay_memory.js:27–40  ·  view source on GitHub ↗

* Constructor of ReplayMemory. * * @param {number} maxLen Maximal buffer length.

(maxLen)

Source from the content-addressed store, hash-verified

25 * @param {number} maxLen Maximal buffer length.
26 */
27 constructor(maxLen) {
28 this.maxLen = maxLen;
29 this.buffer = [];
30 for (let i = 0; i < maxLen; ++i) {
31 this.buffer.push(null);
32 }
33 this.index = 0;
34 this.length = 0;
35
36 this.bufferIndices_ = [];
37 for (let i = 0; i < maxLen; ++i) {
38 this.bufferIndices_.push(i);
39 }
40 }
41
42 /**
43 * Append an item to the replay buffer.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected