You can always use cudaFree on a tensor’s raw storage address as following, as long as you know the tensor is allocated on GPU.
cudaFree(tensor.storage()->data())
The nn::Module provides apis to get every tensor under that module (and its submodules if any). For conv2d, I think you just need to free its weight tensor and bias tensor within it.
But, the whole workflow seems weird to me. It seems to me that you inherit from an NN module and actually don’t need the content within it.