@Hamid, you can check the size of the weight matrix.
size = m.weight.size() # returns a tuple
fan_out = size[0] # number of rows
fan_in = size[1] # number of columns

@apaszke, thanks for the heads-up! I’m still new to the Python world…
Edit: apply @apaszke fix.