MCPcopy
hub / github.com/tensorflow/tfjs / wrap

Method wrap

tfjs-data/src/util/ring_buffer.ts:50–56  ·  view source on GitHub ↗

* Map any index into the range 0 <= index < 2*capacity.

(index: number)

Source from the content-addressed store, hash-verified

48 * Map any index into the range 0 <= index < 2*capacity.
49 */
50 protected wrap(index: number) {
51 // don't trust % on negative numbers
52 while (index < 0) {
53 index += this.doubledCapacity;
54 }
55 return index % this.doubledCapacity;
56 }
57
58 protected get(index: number) {
59 if (index < 0) {

Callers 6

pushMethod · 0.95
popMethod · 0.95
unshiftMethod · 0.95
shiftMethod · 0.95
shuffleExciseMethod · 0.95
expandMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected