I’m using PyTorch in a setting where the size of the training data can change from one learning task to the next one, so I need to check if the number of items in the tensor is different from the size of the training data, something like
    if (points_.sizes()[0] != mesh.nCells())
    {
        points_ = torch::zeros({mesh.nCells(),3});
        values_ = torch::zeros({mesh.nCells(),1});
    }

The mesh can change in terms of the number of cells (never mind what those are), and I would not like to perform points_= and values_= if this is not necessary. The number of points_ equals the number of values_, which in turn equals to mesh.nCells().