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

Method set

tfjs-core/src/tensor.ts:80–91  ·  view source on GitHub ↗

* Sets a value in the buffer at a given location. * * @param value The value to set. * @param locs The location indices. * * @doc {heading: 'Tensors', subheading: 'Creation'}

(value: SingleValueMap[D], ...locs: number[])

Source from the content-addressed store, hash-verified

78 * @doc {heading: 'Tensors', subheading: 'Creation'}
79 */
80 set(value: SingleValueMap[D], ...locs: number[]): void {
81 if (locs.length === 0) {
82 locs = [0];
83 }
84 util.assert(
85 locs.length === this.rank,
86 () => `The number of provided coordinates (${locs.length}) must ` +
87 `match the rank (${this.rank})`);
88
89 const index = this.locToIndex(locs);
90 this.values[index] = value as number;
91 }
92
93 /**
94 * Returns the value in the buffer at the provided location.

Callers 15

conv2DBackpropFilterFunction · 0.95
reverseFunction · 0.95
uniqueImplFunction · 0.95
karma.conf.jsFile · 0.45
surfaceMethod · 0.45
registerSurfaceMethod · 0.45
barchartFunction · 0.45
nextBatchMethod · 0.45
nextBatchMethod · 0.45
inferMethod · 0.45

Calls 1

locToIndexMethod · 0.95

Tested by

no test coverage detected