I have constructed a network using C++ API. I want to assign my network layers to specific weight and bias that I get from pretrained tensorflow model. How can I achieve this? One of my layer declaration is as follows:
torch::nn::Sequential conv1_1{
torch::nn::Conv2d(torch::nn::Conv2dOptions(3,64,3).stride(1).padding(1).bias(true)),
torch::nn::ReLU()
};
For now I am assigning parameters randomly as follows:
torch::NoGradGuard no_grad;
for (auto& p : this->parameters()){
p.uniform_(-1,1);
}
How can I assign a tensor as weight to a layer?