TypeError: ‘Conv2d’ object is not iterable

Hi I don’t know if this’ll help but I found that in order to do xavier_uniform one should do:

linear1=torch.nn.Linear(N_FEATURES, hiddenLayerSize, bias=True)
torch.nn.init.xavier_uniform(linear1.weight)

instead of:

nn.init.xavier_uniform(m.weight,gain=nn.init.calculate_gain(‘relu’))

It’s discussed here: How to initialize the conv layers with xavier weights initialization?