So I am not 100% sure what you are doing but you can simply provide a function in your network that does the following
void YourNet::Init() {

    torch::NoGradGuard no_grad;
    
    for (auto& p : this->parameters()) {
        
        p.uniform_(-1, 1); // or whatever initialization you are looking for, see link below
    }
}

And then call this function in your constructor or elsewhere. Other possible initializations can be found in the documentation of Tensor 20