Yeah well, I usually just introduce a local scope for that.
void myfunc() {
some code here
{
torch::Tensor a = ...
}
here a is gone
}
But if you must: Assigning the default-constructed undefined Tensor would likely work, too.
Best regards
Thomas