Hi there,
i am trying to optimise a CNN using methods of variational optimisation David Barbr blog on VO., here you draw samples from a gaussian-dist and assign them to the network’s weights.
till now i did byjust looping through the net parameters:
for param in list(net.parameters()):
param_length = np.prod(list(param.size())).astype(np.int)
sample_ = sample[idx: idx + param_length]
sample_ = sample_.view(param.data.size())
param.data = sample_.data
idx += param_length
I would like to know if there is some better way to assgin weights to a network manually. btw. i also have read this question Assign variable to model parameter.