I might misunderstand your code snippet, but it seems you are indexing the input, not any “neurons”.
If you want to get the filters in the conv layer or weight connections in the linear layer, you can access them via layer.weight.