Hey @Omegastick,
how about doing this instead
IntList sizes = net->named_parameters()["layer"].sizes();
torch::Tensor tensor = torch::from_blob(data.data(), sizes); // where data is an std::vector<float>

net->named_parameters()["layer"].set_data(tensor);