sorry, just a typo. I meant
model->named_parameters()["conv1.weight"] = tensor_with_custom_weights.clone().detach();

my model structure is this:
AlexNetImpl(
  (linear1): torch::nn::Linear(in_features=9216, out_features=4096, bias=true)
  (linear2): torch::nn::Linear(in_features=4096, out_features=4096, bias=true)
  (linear3): torch::nn::Linear(in_features=4096, out_features=21, bias=true)
  (dropout): torch::nn::Dropout(p=0.5, inplace=false)
  (conv1): torch::nn::Conv2d(3, 96, kernel_size=[11, 11], stride=[4, 4])
  (conv2): torch::nn::Conv2d(96, 256, kernel_size=[5, 5], stride=[1, 1], padding=[2, 2])
  (conv3): torch::nn::Conv2d(256, 384, kernel_size=[3, 3], stride=[1, 1], padding=[1, 1])
  (conv4): torch::nn::Conv2d(384, 384, kernel_size=[3, 3], stride=[1, 1], padding=[1, 1])
  (conv5): torch::nn::Conv2d(384, 256, kernel_size=[3, 3], stride=[1, 1], padding=[1, 1])
  (lrnorm1): torch::nn::LocalResponseNorm(5, alpha=0.0001, beta=0.75, k=2)
)

and this is the output of the for-loop (instead of tensor values, just the sizes) :
Parameters of the model: AlexNetImpl
-----------------------------------------
   > linear1.weight [4096, 9216]
   > linear1.bias [4096]
   > linear2.weight [4096, 4096]
   > linear2.bias [4096]
   > linear3.weight [21, 4096]
   > linear3.bias [21]
   > conv1.weight [96, 3, 11, 11]
   > conv1.bias [96]
   > conv2.weight [256, 96, 5, 5]
   > conv2.bias [256]
   > conv3.weight [384, 256, 3, 3]
   > conv3.bias [384]
   > conv4.weight [384, 384, 3, 3]
   > conv4.bias [384]
   > conv5.weight [256, 384, 3, 3]
   > conv5.bias [256]

but still I don’t get the correct values after loading the model.
by the way, thanks for the help.