xs = [G.parameters(), D.parameters()]
for i in xs[0]:
print(i)
print("+++++++")
for i in xs[0]:
print(i)
print("++++++++++")
生成结果是:
Parameter containing:
tensor([[ 1.0000e+00, 7.8245e-11, 7.8229e-12, ..., 3.5181e-11,
4.7598e-11, -1.0584e-11],
[ 7.5359e-11, 1.0000e+00, -2.6498e-11, ..., -1.1916e-10,
-1.6122e-10, 3.5851e-11],
[-3.7384e-11, 1.3148e-10, 1.0000e+00, ..., 5.9115e-11,
7.9981e-11, -1.7785e-11],
...,
[ 3.4832e-11, -1.2250e-10, -1.2248e-11, ..., -5.5080e-11,
-7.4521e-11, 1.6571e-11],
[ 4.5728e-11, -1.6082e-10, -1.6079e-11, ..., -7.2309e-11,
-9.7831e-11, 2.1755e-11],
[-5.3558e-11, 1.8836e-10, 1.8832e-11, ..., 8.4690e-11,
1.1458e-10, -2.5480e-11]], device='cuda:0')
Parameter containing:
tensor(1.00000e-09 *
[ 0.5833, -1.9758, 0.9802, -0.9176, 0.2137, 1.8667, 0.3128,
-0.9133, -1.1989, 1.4042], device='cuda:0')
+++++++
+++++++++
xs[0]在被调用一次以后就好像会被清空(结构依旧保留)。