setItem(elementIndex, tensor) {
        if (tensor.dtype !== this.elementDtype) throw new Error(`Invalid data types; op elements ${tensor.dtype}, but list elements ${this.elementDtype}`);
        if (elementIndex < 0 || this.maxNumElements !== -1 && elementIndex >= this.maxNumElements) throw new Error(`Trying to set element ${elementIndex} in a list with max ${this.maxNumElements} elements.`);
        (0, _tensorUtils.assertShapesMatchAllowUndefinedSize)(this.elementShape, tensor.shape, "TensorList shape mismatch: ");
        (0, _tfjsCore.keep)(tensor);
        // dispose the previous value if it is replacing.
        if (this.tensors[elementIndex] != null) this.tensors[elementIndex].kept = false;
        this.tensors[elementIndex] = tensor;
    }
Set the tensor at the index
@param elementIndex index of the tensor
@param tensor the tensor to be inserted into the list