I come from tensorflow and I know that tf.get_variable() (https://www.tensorflow.org/programmers_guide/variable_scope 18) is very useful because then I don’t have to have giant list of things were I define variables and instead they are included in the graph as I create more variables. i.e. I avoid:
D,H_l1 = 2,1
w_init = torch.zeros(H_l1,D).type(dtype)
W_l1 = Variable(w_init, requires_grad=True)

D,H_l2 = 2,1
w_init = torch.zeros(H_l2,D).type(dtype)
W_l2 = Variable(w_init, requires_grad=True)

what is the equivalent way to deal with this in pytorch?