* 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[])
| 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. |
no test coverage detected