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

Method pushBack

tfjs-converter/src/executor/tensor_list.ts:158–172  ·  view source on GitHub ↗

* Push a tensor to the end of the list. * @param tensor Tensor to be pushed.

(tensor: Tensor)

Source from the content-addressed store, hash-verified

156 * @param tensor Tensor to be pushed.
157 */
158 pushBack(tensor: Tensor) {
159 if (tensor.dtype !== this.elementDtype) {
160 throw new Error(`Invalid data types; op elements ${
161 tensor.dtype}, but list elements ${this.elementDtype}`);
162 }
163
164 assertShapesMatchAllowUndefinedSize(
165 tensor.shape, this.elementShape, 'TensorList shape mismatch: ');
166
167 if (this.maxNumElements === this.size()) {
168 throw new Error(`Trying to push element into a full list.`);
169 }
170 keep(tensor);
171 this.tensors.push(tensor);
172 }
173
174 /**
175 * Update the size of the list.

Callers 2

executeOpFunction · 0.80

Calls 4

sizeMethod · 0.95
keepFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected