Pytorch之parameters的使用
1.预构建网络
class Net(nn.Module): def __init__(self): super(Net, self).__init__() # 1 input image channel, 6 output channels, 5*5 square convolution # kernel self.conv1 = nn.Conv2d(1, 6, 5) self.conv2 = nn.Conv2d(6, 16, 5) # an affine operation: y = Wx + b self.fc1 = nn.Linear(16 * 5 * 5, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, 10) def forward(self, x): # max pooling over a (2, 2) window x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2)) # If size is a square you can only specify a single number x = F.max_pool2d(F.relu(self.conv2(x)), 2) x = x.view(-1, self.num_flat_features(x)) x = F.relu(self.fc1(x)) x = F.relu(self.fc2(x)) x = self.fc3(x) return x def num_flat_features(self, x): size = x.size()[1:] # all dimensions except the batch dimension num_features = 1 for s in size: num_features *= s return num_features net = Net()
网络结构
Net( (conv1): Conv2d(1, 6, kernel_size=(5, 5), stride=(1, 1)) (conv2): Conv2d(6, 16, kernel_size=(5, 5), stride=(1, 1)) (fc1): Linear(in_features=400, out_features=120, bias=True) (fc2): Linear(in_features=120, out_features=84, bias=True) (fc3): Linear(in_features=84, out_features=10, bias=True) )
2.net.parameters()
构建好神经网络后,网络的参数都保存在parameters()函数当中
print(net.parameters())
输出 <generator object Module.parameters at 0x0000000003161200>
para = list(net.parameters()) print(para) #len返回列表项个数 print(len(para))
输出
[Parameter containing: tensor([[[[-0.0596, 0.1908, 0.1831, 0.0542, -0.0283], [-0.0542, -0.1680, 0.1566, 0.1036, -0.1756], [-0.1437, 0.0083, 0.0871, 0.1549, 0.1556], [ 0.1360, 0.0171, 0.1034, -0.1548, -0.1343], [-0.0978, -0.1803, -0.0701, -0.0377, 0.0290]]], [[[-0.1020, 0.0862, -0.1227, -0.1742, 0.1510], [ 0.0728, 0.1725, 0.0352, 0.1579, 0.0367], [ 0.0862, -0.0995, 0.1276, -0.1895, -0.1346], [ 0.1938, 0.1387, -0.1983, -0.1015, -0.0740], [-0.0248, -0.0546, 0.0849, 0.1510, -0.0066]]], [[[ 0.1333, 0.0300, 0.0969, -0.0295, 0.0879], [ 0.1216, -0.0864, 0.0259, 0.0157, -0.1330], [-0.1873, 0.1309, 0.1947, 0.1886, 0.1944], [-0.0647, 0.0957, 0.1592, 0.1894, 0.1862], [ 0.0896, 0.1287, -0.0650, 0.0684, 0.1182]]], [[[-0.0816, 0.0968, 0.1259, -0.1124, -0.0864], [-0.0450, 0.0737, 0.0483, 0.1180, -0.0933], [-0.0925, -0.0549, 0.1191, 0.0165, 0.1369], [-0.1771, -0.1937, 0.1542, 0.1105, 0.1572], [ 0.1163, -0.1577, 0.1426, 0.0431, -0.0362]]], [[[-0.0675, -0.1039, 0.0762, -0.1798, 0.0071], [-0.1794, 0.1942, 0.0540, 0.1887, 0.1413], [ 0.1366, 0.0682, 0.1230, 0.0184, -0.0980], [-0.1613, 0.1225, -0.0734, 0.1938, 0.1919], [ 0.1745, -0.1550, 0.0663, 0.0044, -0.0538]]], [[[-0.0926, 0.1146, 0.1008, 0.1644, 0.1046], [-0.1230, 0.0080, 0.0198, -0.1216, -0.1942], [ 0.0327, 0.0205, 0.0862, -0.1714, 0.0955], [ 0.0358, -0.1350, 0.1387, -0.1365, -0.1600], [ 0.0368, -0.1323, -0.0127, 0.0917, -0.1892]]]], requires_grad=True), Parameter containing: tensor([-0.0229, -0.1387, -0.1571, -0.0381, -0.1559, 0.0946], requires_grad=True), Parameter containing: tensor([[[[-0.0497, -0.0356, -0.0272, -0.0519, 0.0451], [-0.0247, 0.0228, 0.0705, -0.0341, -0.0454], [ 0.0129, -0.0385, 0.0682, -0.0613, 0.0497], [-0.0394, 0.0218, -0.0056, 0.0204, -0.0668], [ 0.0469, 0.0649, -0.0470, 0.0138, -0.0686]], [[ 0.0647, 0.0554, -0.0220, -0.0295, -0.0145], [ 0.0500, -0.0026, 0.0545, 0.0415, 0.0020], [-0.0802, 0.0742, -0.0291, 0.0679, -0.0657], [ 0.0309, 0.0729, -0.0158, -0.0495, -0.0220], [-0.0433, 0.0440, -0.0485, 0.0478, 0.0618]], [[ 0.0523, -0.0072, -0.0786, 0.0569, 0.0334], [-0.0254, -0.0043, -0.0113, 0.0755, -0.0590], [ 0.0113, -0.0170, 0.0318, -0.0764, -0.0210], [-0.0203, -0.0273, 0.0634, 0.0380, 0.0014], [-0.0112, 0.0555, -0.0129, -0.0395, 0.0624]], [[ 0.0387, 0.0189, -0.0007, -0.0604, 0.0114], [ 0.0481, 0.0551, 0.0182, 0.0474, 0.0390], [ 0.0152, -0.0106, -0.0381, -0.0630, -0.0645], [ 0.0092, -0.0295, -0.0616, 0.0571, 0.0562], [ 0.0418, -0.0372, 0.0269, 0.0109, -0.0758]], [[-0.0751, -0.0610, 0.0269, -0.0331, -0.0193], [ 0.0577, 0.0430, -0.0201, -0.0017, -0.0408], [-0.0590, -0.0148, 0.0790, 0.0575, -0.0786], [ 0.0168, 0.0335, 0.0170, -0.0792, 0.0344], [-0.0738, 0.0193, -0.0732, -0.0666, -0.0734]], [[ 0.0154, 0.0712, 0.0540, -0.0429, 0.0573], [-0.0423, 0.0424, -0.0488, 0.0317, 0.0808], [ 0.0605, 0.0324, -0.0020, -0.0538, 0.0664], [ 0.0243, -0.0452, 0.0070, -0.0287, -0.0476], [ 0.0087, 0.0561, -0.0076, -0.0391, 0.0795]]], [[[ 0.0773, 0.0748, -0.0133, 0.0651, 0.0659], [ 0.0254, 0.0222, 0.0017, -0.0722, 0.0667], [ 0.0357, -0.0677, 0.0085, -0.0005, -0.0313], [ 0.0672, -0.0359, -0.0243, -0.0811, -0.0726], [ 0.0011, 0.0226, 0.0278, -0.0615, -0.0410]], [[ 0.0202, 0.0519, 0.0527, -0.0086, -0.0683], [ 0.0694, 0.0434, 0.0746, 0.0754, 0.0073], [ 0.0036, -0.0692, -0.0732, -0.0250, -0.0470], [-0.0669, 0.0609, 0.0649, -0.0158, 0.0189], [-0.0564, 0.0370, 0.0464, -0.0530, 0.0487]], [[ 0.0068, 0.0722, 0.0629, -0.0214, 0.0673], [-0.0384, 0.0799, -0.0350, 0.0816, 0.0586], [-0.0111, 0.0696, 0.0145, -0.0397, -0.0784], [-0.0120, 0.0555, 0.0021, -0.0494, -0.0344], [-0.0335, 0.0502, -0.0490, -0.0701, 0.0135]], [[-0.0365, 0.0733, 0.0610, 0.0028, 0.0292], [ 0.0552, -0.0674, 0.0176, -0.0131, 0.0688], [ 0.0147, -0.0432, 0.0473, -0.0231, -0.0314], [-0.0194, 0.0508, -0.0475, 0.0599, 0.0286], [ 0.0055, 0.0287, -0.0391, -0.0543, 0.0778]], [[-0.0241, -0.0322, 0.0704, -0.0758, -0.0562], [-0.0675, -0.0265, -0.0444, -0.0370, 0.0581], [-0.0577, 0.0462, 0.0165, 0.0146, -0.0317], [ 0.0047, 0.0666, -0.0365, 0.0749, 0.0677], [ 0.0557, 0.0098, 0.0451, 0.0306, -0.0628]], [[ 0.0529, 0.0167, 0.0501, 0.0679, 0.0505], [-0.0006, -0.0432, -0.0128, 0.0794, -0.0794], [ 0.0016, -0.0504, -0.0252, 0.0266, 0.0635], [ 0.0305, -0.0807, -0.0236, -0.0810, -0.0010], [-0.0423, -0.0285, -0.0559, 0.0560, 0.0796]]], [[[-0.0504, 0.0634, 0.0504, -0.0440, 0.0425], [ 0.0517, -0.0268, -0.0517, 0.0646, 0.0693], [ 0.0566, 0.0194, 0.0426, -0.0787, 0.0163], [-0.0661, -0.0457, 0.0691, -0.0058, -0.0073], [ 0.0794, 0.0645, 0.0367, -0.0625, -0.0731]], [[ 0.0190, 0.0393, 0.0145, -0.0073, 0.0478], [ 0.0405, 0.0038, -0.0349, -0.0022, 0.0202], [ 0.0346, -0.0622, 0.0194, -0.0151, 0.0220], [ 0.0002, -0.0663, 0.0730, -0.0462, -0.0182], [ 0.0311, -0.0079, 0.0720, 0.0517, -0.0601]], [[-0.0039, -0.0102, -0.0599, -0.0220, -0.0467], [-0.0495, -0.0265, 0.0484, 0.0497, 0.0090], [-0.0260, 0.0256, 0.0476, -0.0585, 0.0411], [-0.0505, -0.0447, -0.0002, -0.0121, -0.0170], [ 0.0400, 0.0457, 0.0709, 0.0195, 0.0762]], [[ 0.0732, -0.0100, 0.0115, -0.0046, -0.0133], [ 0.0333, -0.0065, 0.0115, 0.0057, 0.0370], [ 0.0328, -0.0513, 0.0648, 0.0588, 0.0230], [ 0.0154, 0.0261, 0.0579, 0.0118, 0.0050], [ 0.0089, 0.0468, -0.0763, -0.0314, 0.0676]], [[ 0.0428, -0.0646, -0.0339, 0.0185, -0.0042], [-0.0480, 0.0639, -0.0366, -0.0537, 0.0241], [-0.0572, 0.0309, -0.0761, 0.0227, -0.0385], [-0.0546, -0.0338, 0.0277, -0.0650, -0.0081], [ 0.0690, -0.0083, 0.0295, 0.0088, 0.0360]], [[ 0.0514, 0.0622, -0.0556, -0.0048, -0.0279], [ 0.0112, -0.0413, -0.0483, 0.0166, 0.0690], [-0.0433, 0.0410, -0.0335, -0.0458, -0.0055], [ 0.0229, 0.0289, 0.0695, 0.0574, 0.0075], [ 0.0651, -0.0337, -0.0130, -0.0381, 0.0272]]], ..., [[[-0.0538, 0.0321, 0.0302, 0.0222, -0.0062], [ 0.0050, -0.0461, 0.0084, -0.0448, -0.0604], [-0.0457, 0.0455, -0.0773, -0.0437, 0.0446], [ 0.0691, 0.0390, -0.0040, 0.0035, -0.0133], [ 0.0545, 0.0517, -0.0067, 0.0314, -0.0448]], [[ 0.0029, -0.0675, -0.0254, -0.0168, -0.0563], [ 0.0163, -0.0621, -0.0561, -0.0151, -0.0306], [-0.0021, 0.0389, -0.0429, 0.0778, 0.0451], [-0.0578, 0.0123, 0.0049, -0.0728, -0.0408], [ 0.0722, 0.0388, 0.0177, 0.0526, -0.0291]], [[ 0.0369, 0.0502, 0.0646, 0.0388, -0.0091], [ 0.0066, 0.0501, 0.0114, 0.0243, -0.0455], [ 0.0494, 0.0495, -0.0257, 0.0165, -0.0024], [-0.0476, -0.0552, 0.0029, -0.0813, 0.0698], [-0.0704, -0.0590, -0.0641, 0.0284, 0.0578]], [[ 0.0180, 0.0794, -0.0090, -0.0081, 0.0570], [-0.0529, 0.0517, 0.0045, -0.0580, -0.0192], [-0.0289, 0.0261, 0.0107, 0.0180, -0.0062], [-0.0162, 0.0607, 0.0154, 0.0450, 0.0694], [ 0.0324, 0.0418, -0.0199, -0.0357, 0.0104]], [[ 0.0525, -0.0401, 0.0803, -0.0453, -0.0534], [ 0.0628, 0.0120, 0.0147, 0.0294, -0.0351], [ 0.0773, -0.0587, -0.0713, 0.0125, -0.0125], [-0.0288, -0.0623, 0.0547, 0.0390, -0.0603], [ 0.0105, -0.0003, -0.0773, 0.0167, 0.0386]], [[ 0.0721, -0.0047, 0.0238, 0.0489, 0.0183], [-0.0127, -0.0090, -0.0588, 0.0641, 0.0460], [-0.0194, -0.0753, -0.0349, 0.0186, 0.0156], [ 0.0248, -0.0801, -0.0794, 0.0811, 0.0644], [-0.0415, 0.0127, -0.0120, -0.0724, -0.0800]]], [[[-0.0781, 0.0279, 0.0056, -0.0164, -0.0423], [ 0.0446, 0.0030, 0.0590, 0.0276, -0.0720], [ 0.0647, -0.0414, -0.0306, -0.0477, 0.0041], [-0.0647, 0.0124, 0.0166, -0.0592, 0.0164], [ 0.0789, -0.0673, -0.0583, 0.0493, 0.0306]], [[-0.0105, 0.0707, -0.0790, -0.0334, 0.0620], [ 0.0095, 0.0763, 0.0055, -0.0716, -0.0078], [ 0.0141, -0.0645, 0.0380, -0.0282, -0.0557], [ 0.0489, 0.0073, 0.0203, 0.0568, -0.0352], [-0.0299, 0.0681, -0.0300, 0.0178, -0.0101]], [[ 0.0401, -0.0572, 0.0219, 0.0427, 0.0276], [-0.0683, 0.0192, 0.0689, 0.0217, -0.0365], [-0.0140, -0.0361, -0.0562, 0.0528, 0.0029], [ 0.0213, 0.0464, 0.0525, -0.0804, 0.0599], [ 0.0770, -0.0657, 0.0655, 0.0741, 0.0462]], [[ 0.0479, 0.0648, -0.0050, 0.0530, -0.0746], [-0.0671, 0.0635, 0.0360, -0.0642, -0.0573], [ 0.0176, -0.0783, -0.0781, -0.0027, 0.0405], [ 0.0057, -0.0685, 0.0673, 0.0697, -0.0792], [-0.0449, -0.0773, -0.0756, -0.0524, 0.0378]], [[ 0.0201, 0.0407, -0.0442, -0.0007, -0.0174], [-0.0779, 0.0032, -0.0650, 0.0172, -0.0081], [ 0.0796, -0.0781, -0.0364, 0.0141, -0.0198], [ 0.0270, 0.0519, -0.0578, -0.0515, 0.0225], [ 0.0212, 0.0231, 0.0071, 0.0190, 0.0285]], [[ 0.0311, 0.0148, 0.0181, 0.0617, 0.0037], [ 0.0754, -0.0596, -0.0498, 0.0388, -0.0612], [ 0.0318, -0.0068, -0.0725, -0.0671, -0.0531], [ 0.0446, 0.0793, 0.0193, 0.0033, -0.0685], [ 0.0426, 0.0017, 0.0477, 0.0556, 0.0341]]], [[[ 0.0264, 0.0640, 0.0658, -0.0286, 0.0150], [-0.0585, 0.0256, -0.0657, 0.0341, 0.0521], [ 0.0732, 0.0577, -0.0740, 0.0150, 0.0718], [-0.0311, -0.0343, 0.0234, -0.0110, 0.0344], [ 0.0698, -0.0613, -0.0400, 0.0648, 0.0735]], [[-0.0569, 0.0414, 0.0089, 0.0080, -0.0155], [-0.0289, -0.0245, -0.0732, 0.0417, 0.0205], [-0.0235, -0.0650, -0.0624, -0.0615, -0.0798], [ 0.0679, 0.0393, 0.0494, -0.0063, 0.0646], [-0.0303, -0.0782, 0.0025, 0.0761, -0.0034]], [[ 0.0738, -0.0106, 0.0397, -0.0621, -0.0492], [ 0.0518, 0.0812, 0.0331, 0.0730, 0.0802], [-0.0672, -0.0441, -0.0760, 0.0190, -0.0191], [ 0.0746, -0.0377, 0.0753, 0.0669, -0.0648], [-0.0325, -0.0538, 0.0273, -0.0089, 0.0195]], [[-0.0117, 0.0272, 0.0785, 0.0456, -0.0539], [ 0.0032, 0.0351, 0.0479, 0.0014, -0.0471], [ 0.0423, 0.0394, -0.0310, -0.0511, 0.0784], [-0.0053, -0.0243, -0.0048, 0.0709, -0.0030], [ 0.0415, 0.0264, 0.0010, -0.0056, 0.0069]], [[ 0.0320, -0.0181, 0.0360, -0.0439, -0.0279], [ 0.0479, -0.0807, 0.0018, -0.0336, 0.0605], [-0.0263, 0.0114, -0.0287, -0.0145, 0.0242], [ 0.0662, 0.0028, -0.0437, 0.0128, 0.0656], [-0.0760, 0.0179, 0.0657, -0.0070, -0.0182]], [[-0.0080, 0.0249, 0.0577, -0.0293, -0.0743], [ 0.0087, -0.0072, 0.0067, 0.0361, 0.0340], [ 0.0071, -0.0265, -0.0689, -0.0633, -0.0563], [ 0.0011, -0.0760, -0.0101, -0.0151, 0.0370], [-0.0111, 0.0191, -0.0481, 0.0536, -0.0312]]]], requires_grad=True), Parameter containing: tensor([ 0.0811, 0.0474, 0.0688, 0.0393, 0.0037, 0.0488, 0.0750, 0.0471, -0.0719, -0.0324, 0.0389, 0.0586, -0.0008, 0.0676, 0.0294, -0.0628], requires_grad=True), Parameter containing: tensor([[-0.0475, -0.0082, -0.0437, ..., -0.0330, 0.0490, 0.0475], [-0.0275, 0.0477, -0.0164, ..., -0.0029, 0.0100, -0.0315], [-0.0226, -0.0392, -0.0472, ..., -0.0402, -0.0272, -0.0432], ..., [-0.0246, -0.0008, 0.0447, ..., 0.0406, -0.0298, -0.0262], [ 0.0467, 0.0372, 0.0408, ..., -0.0421, -0.0001, -0.0135], [-0.0282, 0.0223, 0.0194, ..., -0.0097, -0.0319, 0.0396]], requires_grad=True), Parameter containing: tensor([ 0.0312, 0.0236, 0.0176, 0.0037, -0.0012, -0.0042, 0.0425, 0.0405, 0.0321, 0.0227, 0.0208, -0.0116, 0.0476, -0.0051, 0.0387, -0.0304, 0.0043, 0.0238, 0.0025, 0.0380, 0.0364, 0.0444, 0.0352, 0.0125, -0.0236, -0.0201, 0.0044, 0.0127, -0.0117, 0.0066, 0.0128, -0.0357, 0.0495, 0.0009, -0.0232, 0.0040, -0.0159, -0.0448, 0.0313, 0.0298, -0.0172, -0.0153, -0.0001, 0.0011, -0.0480, -0.0373, 0.0089, -0.0285, 0.0373, -0.0390, 0.0039, -0.0410, 0.0361, -0.0379, -0.0024, 0.0319, -0.0204, 0.0499, 0.0245, 0.0405, -0.0188, 0.0363, -0.0243, -0.0254, -0.0162, 0.0027, -0.0361, -0.0312, -0.0237, 0.0039, 0.0370, 0.0016, 0.0022, 0.0490, -0.0024, -0.0360, -0.0159, 0.0279, 0.0083, 0.0165, -0.0160, 0.0078, -0.0434, 0.0045, -0.0073, -0.0083, 0.0435, 0.0065, 0.0092, -0.0196, -0.0220, -0.0032, -0.0253, -0.0129, 0.0335, 0.0439, 0.0313, 0.0008, -0.0024, -0.0006, 0.0498, -0.0476, 0.0132, 0.0282, -0.0258, 0.0244, -0.0256, 0.0442, -0.0401, 0.0172, 0.0345, -0.0403, 0.0404, 0.0330, 0.0240, -0.0060, -0.0173, 0.0332, 0.0438, 0.0324], requires_grad=True), Parameter containing: tensor([[ 0.0682, 0.0148, 0.0024, ..., -0.0304, -0.0359, 0.0675], [-0.0736, 0.0799, 0.0328, ..., 0.0723, 0.0668, 0.0532], [ 0.0756, 0.0187, -0.0489, ..., 0.0413, -0.0153, 0.0911], ..., [ 0.0413, 0.0286, 0.0177, ..., -0.0861, -0.0364, 0.0363], [-0.0617, -0.0420, -0.0562, ..., -0.0488, 0.0451, -0.0753], [-0.0725, 0.0668, 0.0668, ..., -0.0901, 0.0577, -0.0083]], requires_grad=True), Parameter containing: tensor([-0.0349, -0.0341, -0.0790, -0.0458, -0.0911, -0.0866, -0.0378, -0.0243, -0.0168, 0.0630, 0.0241, -0.0474, -0.0521, 0.0237, 0.0651, -0.0527, -0.0368, -0.0609, 0.0420, -0.0536, 0.0297, -0.0591, 0.0113, -0.0748, 0.0217, 0.0540, 0.0677, 0.0161, -0.0137, 0.0009, 0.0039, -0.0293, 0.0421, -0.0546, 0.0261, -0.0099, -0.0604, 0.0771, 0.0284, -0.0701, -0.0909, 0.0134, 0.0243, 0.0267, 0.0157, 0.0064, -0.0422, -0.0399, 0.0850, -0.0752, 0.0048, -0.0739, 0.0360, -0.0775, 0.0242, 0.0187, -0.0077, 0.0587, 0.0575, 0.0811, 0.0098, 0.0193, 0.0817, 0.0226, 0.0253, -0.0416, -0.0515, 0.0295, 0.0209, -0.0443, -0.0472, -0.0393, 0.0170, -0.0864, 0.0637, 0.0264, -0.0822, -0.0534, -0.0441, -0.0410, 0.0409, -0.0429, 0.0747, 0.0825], requires_grad=True), Parameter containing: tensor([[ 0.0933, -0.0207, -0.0625, 0.0699, -0.0453, -0.0761, -0.0832, 0.0625, 0.0088, -0.0761, -0.1056, -0.0030, -0.0689, -0.0944, 0.0860, 0.0847, 0.0142, -0.0269, 0.0735, -0.0080, -0.0654, 0.0801, -0.0691, 0.0459, 0.0287, 0.0508, -0.0854, 0.0158, -0.0010, -0.0982, 0.1022, 0.0983, -0.0577, 0.0037, -0.0862, 0.0950, 0.0595, -0.0366, -0.0567, -0.0346, 0.0438, 0.0595, -0.0157, -0.0865, -0.0474, 0.0600, 0.0583, -0.0653, 0.0962, -0.0919, -0.0094, -0.0529, 0.0105, -0.0262, -0.0430, -0.0617, 0.0215, -0.0279, -0.0643, -0.0058, 0.0924, -0.0948, 0.0948, 0.1033, -0.0855, 0.0897, -0.0782, 0.0540, -0.0881, -0.0235, 0.0202, 0.0043, 0.0427, 0.0609, 0.0642, 0.0931, -0.0185, -0.0504, -0.0069, 0.0574, -0.0265, -0.0505, 0.0262, 0.0494], [-0.0647, 0.0410, -0.0029, 0.0659, 0.0350, -0.0190, 0.0848, 0.0323, 0.0249, -0.0729, -0.0899, 0.0368, 0.0960, -0.0329, -0.0825, -0.0920, -0.0124, -0.0553, -0.1004, -0.0076, 0.0704, -0.0279, 0.0950, 0.0774, -0.0640, -0.0858, -0.0032, 0.0328, -0.0961, 0.0209, 0.0067, -0.0628, 0.1069, 0.0609, -0.0934, -0.0328, 0.0601, 0.0520, 0.0434, -0.1076, 0.0327, 0.0708, 0.0961, 0.0427, -0.0130, -0.0341, -0.0425, -0.1044, -0.0677, -0.0760, -0.0531, 0.0128, 0.0123, -0.1091, 0.0852, -0.0368, 0.0506, -0.0759, 0.0528, 0.0647, 0.0838, -0.0256, 0.0565, 0.0753, -0.0559, 0.0647, -0.0420, -0.0116, -0.0191, -0.0427, 0.0681, -0.0582, 0.0391, -0.0757, 0.0098, 0.0503, 0.0191, -0.0063, -0.0429, -0.0566, -0.0739, -0.0428, 0.0544, 0.0183], [ 0.0067, 0.0380, -0.0176, -0.0715, -0.0549, 0.0962, 0.0355, -0.0906, 0.0202, 0.0709, 0.0023, 0.0755, -0.0993, 0.0541, -0.0550, 0.0248, -0.0932, -0.0260, 0.1029, -0.0231, -0.0964, -0.0891, -0.0211, -0.0722, 0.0446, 0.0500, 0.0587, 0.0497, -0.1061, -0.0997, -0.0102, 0.0313, 0.0623, 0.0050, -0.0069, 0.0673, -0.0658, 0.1083, -0.0012, 0.0709, -0.0975, -0.0847, 0.0578, 0.0997, -0.0887, 0.0487, 0.0191, -0.0873, -0.0008, -0.0942, -0.0485, 0.0261, -0.0089, 0.0594, -0.0690, 0.0987, 0.0836, -0.0318, 0.0439, 0.0591, 0.0820, 0.0010, -0.0838, 0.0104, -0.0534, -0.0732, -0.0150, 0.0793, 0.0686, -0.0508, 0.0454, 0.0869, 0.0133, 0.0598, -0.0043, -0.0390, 0.0614, -0.0297, 0.0352, 0.0652, -0.0774, -0.0156, -0.0226, 0.0355], [ 0.0012, -0.0315, 0.0838, 0.0080, 0.0325, 0.0805, -0.0054, -0.0746, -0.0250, -0.0120, -0.0037, -0.0950, 0.0746, 0.0066, -0.1013, 0.0301, -0.0776, -0.0181, 0.0938, 0.0627, 0.0888, -0.0217, 0.1007, -0.0174, 0.0960, -0.0866, -0.0873, 0.0747, 0.0552, -0.0443, 0.0784, 0.1001, -0.0328, 0.0386, 0.0802, 0.0276, -0.0714, 0.0509, -0.0348, -0.0464, 0.0676, 0.0938, 0.0685, -0.0985, 0.0432, -0.0987, -0.0563, 0.0582, -0.0138, 0.0509, 0.0392, 0.0908, 0.0376, -0.0579, 0.1034, 0.0461, -0.0510, 0.0745, -0.0447, 0.0248, -0.1040, -0.0600, -0.0639, -0.0350, -0.0812, 0.0287, -0.0342, 0.0274, 0.0212, 0.0190, 0.0673, -0.0570, -0.0320, -0.0476, -0.0152, 0.0154, 0.0199, -0.0973, 0.0614, -0.0794, 0.0210, -0.0102, -0.0125, 0.1074], [ 0.1063, -0.1013, 0.0380, -0.0271, -0.0457, 0.0205, -0.0071, 0.0985, 0.0569, -0.0283, 0.0494, -0.0548, 0.0142, 0.0047, 0.0646, -0.0903, -0.0089, -0.0945, 0.0050, -0.0304, -0.0058, 0.0833, -0.1055, 0.0071, 0.0397, -0.0592, -0.0156, -0.0940, -0.0198, 0.0241, -0.0241, -0.0299, -0.0764, 0.0725, 0.0215, -0.0002, 0.0380, 0.0081, 0.0422, -0.0312, -0.0346, 0.0854, -0.0751, 0.0749, -0.0767, 0.0197, 0.0360, 0.0932, 0.0818, -0.0416, -0.0079, -0.0982, -0.1081, 0.1002, 0.0007, 0.0047, 0.0829, -0.0354, -0.0034, 0.0529, -0.0712, 0.0277, 0.0826, -0.0883, -0.0738, 0.0713, 0.0276, -0.0088, 0.1027, 0.0437, 0.0649, -0.0988, 0.0022, 0.0367, -0.0122, 0.1037, 0.0424, 0.0078, 0.0673, -0.0672, 0.0365, -0.0655, -0.0897, -0.0060], [ 0.0624, -0.1046, 0.0262, -0.1060, -0.0777, 0.0284, -0.0273, -0.0677, 0.0551, 0.0854, -0.1024, -0.0598, -0.0534, -0.0248, -0.0260, 0.0670, -0.0736, 0.0003, 0.0888, 0.0071, 0.0255, -0.0868, 0.0522, -0.1004, -0.0999, 0.0138, 0.0931, 0.0567, 0.0954, 0.0333, -0.0543, -0.0247, 0.1058, 0.0855, -0.0132, -0.0682, -0.0004, 0.0740, -0.0042, 0.0707, 0.0549, -0.0046, -0.0439, -0.0504, 0.0302, 0.1058, 0.0606, -0.0812, -0.0082, -0.0801, -0.0320, 0.0691, 0.0740, -0.0344, -0.0354, 0.0713, -0.0984, -0.0976, -0.0726, -0.0398, 0.0096, 0.0115, -0.0570, 0.0385, -0.0697, -0.0370, 0.0772, -0.1068, 0.0097, -0.0927, 0.0767, 0.0889, -0.0755, 0.0978, -0.0471, -0.0240, -0.0996, -0.1091, 0.0211, -0.0500, 0.0238, 0.0725, 0.0794, -0.0496], [-0.0850, 0.0658, -0.0064, 0.0097, 0.0650, 0.0075, -0.0627, -0.0538, -0.0123, 0.1041, -0.0837, -0.0620, 0.0620, 0.0814, -0.0696, -0.0535, 0.0680, -0.0468, -0.0347, -0.0950, -0.0020, -0.0560, -0.0118, 0.0160, 0.0525, -0.0800, 0.0152, 0.0780, 0.0692, 0.0145, 0.0298, 0.0668, -0.0857, 0.0379, 0.0262, -0.0240, -0.0002, 0.0358, 0.1027, -0.0882, -0.0120, -0.0364, 0.0450, -0.0409, 0.0734, -0.0147, 0.0104, -0.0638, -0.0831, 0.0770, -0.0336, -0.0944, 0.0570, -0.0359, -0.0376, -0.0563, 0.0341, -0.0075, -0.0501, 0.0724, -0.0501, -0.0783, 0.0453, -0.0150, -0.0106, 0.0109, -0.0479, 0.0527, -0.0272, 0.0638, -0.0136, -0.0106, 0.0710, 0.0281, -0.0600, 0.0202, -0.0595, -0.1032, 0.0891, 0.0308, 0.0624, 0.0160, 0.0935, -0.0290], [-0.0420, 0.0642, 0.0096, 0.0056, -0.0954, -0.0231, 0.0536, 0.0239, 0.0520, 0.0656, 0.0722, -0.0495, 0.0226, 0.0359, 0.0317, 0.0162, -0.0188, -0.0342, -0.0720, 0.1008, -0.0424, -0.0066, -0.0008, 0.0624, 0.0443, -0.0553, 0.0651, 0.0434, -0.0318, -0.0192, -0.1064, -0.0319, -0.0928, 0.0799, 0.0007, -0.0114, -0.0520, 0.0240, 0.0953, -0.0619, -0.0639, 0.0366, -0.0255, -0.0736, -0.0933, -0.0315, -0.1080, -0.1062, 0.0589, 0.0623, 0.0540, 0.0721, -0.0768, 0.0105, -0.0027, 0.0621, -0.0751, 0.0233, -0.0751, -0.0806, -0.0826, 0.0300, -0.0291, 0.0383, -0.0808, 0.1007, -0.0543, 0.0035, -0.0561, 0.0085, -0.0836, -0.1047, 0.0627, -0.1059, 0.0810, -0.0403, -0.0432, -0.1090, 0.0539, 0.0472, 0.0431, -0.0725, 0.0756, 0.0827], [-0.0824, -0.0121, -0.0877, 0.1064, 0.0574, 0.0816, -0.0948, -0.0348, -0.0750, 0.0935, -0.0948, 0.0401, -0.0775, 0.0102, -0.1091, -0.0275, 0.0953, 0.0511, 0.0871, 0.1013, -0.0493, 0.0454, -0.0099, -0.0197, 0.0263, -0.0975, -0.0862, -0.0693, 0.0910, -0.0355, -0.0826, -0.0047, -0.0917, 0.0405, 0.0405, 0.1026, 0.0680, 0.0931, -0.1053, -0.0651, -0.0820, 0.0002, 0.0001, -0.0373, -0.1021, -0.1002, 0.0142, 0.0693, -0.0751, -0.0405, -0.0484, -0.0259, 0.0772, 0.0777, 0.0067, -0.0434, -0.0317, 0.0415, -0.0672, 0.1077, 0.0045, 0.0755, 0.0651, 0.0079, -0.0981, -0.0223, 0.0464, 0.0021, 0.0144, -0.0223, -0.0271, 0.0137, -0.0451, -0.0577, -0.0458, 0.0913, 0.0558, 0.0918, 0.0410, -0.0722, -0.0629, -0.0514, -0.0731, -0.0570], [ 0.1043, 0.1052, 0.0250, -0.0043, 0.0986, -0.0534, -0.1024, 0.0554, -0.0078, -0.0471, 0.0544, 0.0681, -0.0622, -0.0091, 0.0758, 0.0934, -0.0542, -0.0845, -0.0403, -0.1076, -0.0085, 0.0910, -0.0098, 0.0186, -0.0303, 0.0304, -0.0351, -0.0248, 0.0187, -0.0322, -0.0920, 0.0445, -0.0500, 0.0889, 0.0710, 0.0989, 0.0297, -0.0436, 0.0269, -0.0728, -0.0240, 0.0733, 0.0580, 0.0733, 0.0953, -0.0651, -0.0860, 0.0124, 0.1046, 0.0657, -0.0190, -0.0595, 0.0981, 0.1066, -0.0814, -0.0410, -0.0362, 0.0359, -0.0863, -0.0438, 0.0252, 0.0351, 0.1041, -0.0746, 0.0200, 0.0790, -0.1074, 0.0858, -0.0384, -0.0569, 0.0093, 0.1086, 0.0327, 0.0278, -0.0765, -0.0221, 0.0803, 0.0598, -0.0706, 0.0766, 0.0773, -0.0794, -0.0625, -0.0219]], requires_grad=True), Parameter containing: tensor([-0.1061, -0.0962, 0.0518, 0.0545, -0.0188, -0.0293, -0.0951, 0.0373, -0.0218, -0.0068], requires_grad=True)] 10
逐列表项输出列表元素和index
利用enumerate函数实现
#逐列表项输出参数和当前参数位于列表的第几项 for num,temp in enumerate(para): print('number:',num) print(temp)
输出
number: 0 Parameter containing: tensor([[[[-0.0596, 0.1908, 0.1831, 0.0542, -0.0283], [-0.0542, -0.1680, 0.1566, 0.1036, -0.1756], [-0.1437, 0.0083, 0.0871, 0.1549, 0.1556], [ 0.1360, 0.0171, 0.1034, -0.1548, -0.1343], [-0.0978, -0.1803, -0.0701, -0.0377, 0.0290]]], [[[-0.1020, 0.0862, -0.1227, -0.1742, 0.1510], [ 0.0728, 0.1725, 0.0352, 0.1579, 0.0367], [ 0.0862, -0.0995, 0.1276, -0.1895, -0.1346], [ 0.1938, 0.1387, -0.1983, -0.1015, -0.0740], [-0.0248, -0.0546, 0.0849, 0.1510, -0.0066]]], [[[ 0.1333, 0.0300, 0.0969, -0.0295, 0.0879], [ 0.1216, -0.0864, 0.0259, 0.0157, -0.1330], [-0.1873, 0.1309, 0.1947, 0.1886, 0.1944], [-0.0647, 0.0957, 0.1592, 0.1894, 0.1862], [ 0.0896, 0.1287, -0.0650, 0.0684, 0.1182]]], [[[-0.0816, 0.0968, 0.1259, -0.1124, -0.0864], [-0.0450, 0.0737, 0.0483, 0.1180, -0.0933], [-0.0925, -0.0549, 0.1191, 0.0165, 0.1369], [-0.1771, -0.1937, 0.1542, 0.1105, 0.1572], [ 0.1163, -0.1577, 0.1426, 0.0431, -0.0362]]], [[[-0.0675, -0.1039, 0.0762, -0.1798, 0.0071], [-0.1794, 0.1942, 0.0540, 0.1887, 0.1413], [ 0.1366, 0.0682, 0.1230, 0.0184, -0.0980], [-0.1613, 0.1225, -0.0734, 0.1938, 0.1919], [ 0.1745, -0.1550, 0.0663, 0.0044, -0.0538]]], [[[-0.0926, 0.1146, 0.1008, 0.1644, 0.1046], [-0.1230, 0.0080, 0.0198, -0.1216, -0.1942], [ 0.0327, 0.0205, 0.0862, -0.1714, 0.0955], [ 0.0358, -0.1350, 0.1387, -0.1365, -0.1600], [ 0.0368, -0.1323, -0.0127, 0.0917, -0.1892]]]], requires_grad=True) number: 1 Parameter containing: tensor([-0.0229, -0.1387, -0.1571, -0.0381, -0.1559, 0.0946], requires_grad=True) number: 2 Parameter containing: tensor([[[[-0.0497, -0.0356, -0.0272, -0.0519, 0.0451], [-0.0247, 0.0228, 0.0705, -0.0341, -0.0454], [ 0.0129, -0.0385, 0.0682, -0.0613, 0.0497], [-0.0394, 0.0218, -0.0056, 0.0204, -0.0668], [ 0.0469, 0.0649, -0.0470, 0.0138, -0.0686]], [[ 0.0647, 0.0554, -0.0220, -0.0295, -0.0145], [ 0.0500, -0.0026, 0.0545, 0.0415, 0.0020], [-0.0802, 0.0742, -0.0291, 0.0679, -0.0657], [ 0.0309, 0.0729, -0.0158, -0.0495, -0.0220], [-0.0433, 0.0440, -0.0485, 0.0478, 0.0618]], [[ 0.0523, -0.0072, -0.0786, 0.0569, 0.0334], [-0.0254, -0.0043, -0.0113, 0.0755, -0.0590], [ 0.0113, -0.0170, 0.0318, -0.0764, -0.0210], [-0.0203, -0.0273, 0.0634, 0.0380, 0.0014], [-0.0112, 0.0555, -0.0129, -0.0395, 0.0624]], [[ 0.0387, 0.0189, -0.0007, -0.0604, 0.0114], [ 0.0481, 0.0551, 0.0182, 0.0474, 0.0390], [ 0.0152, -0.0106, -0.0381, -0.0630, -0.0645], [ 0.0092, -0.0295, -0.0616, 0.0571, 0.0562], [ 0.0418, -0.0372, 0.0269, 0.0109, -0.0758]], [[-0.0751, -0.0610, 0.0269, -0.0331, -0.0193], [ 0.0577, 0.0430, -0.0201, -0.0017, -0.0408], [-0.0590, -0.0148, 0.0790, 0.0575, -0.0786], [ 0.0168, 0.0335, 0.0170, -0.0792, 0.0344], [-0.0738, 0.0193, -0.0732, -0.0666, -0.0734]], [[ 0.0154, 0.0712, 0.0540, -0.0429, 0.0573], [-0.0423, 0.0424, -0.0488, 0.0317, 0.0808], [ 0.0605, 0.0324, -0.0020, -0.0538, 0.0664], [ 0.0243, -0.0452, 0.0070, -0.0287, -0.0476], [ 0.0087, 0.0561, -0.0076, -0.0391, 0.0795]]], [[[ 0.0773, 0.0748, -0.0133, 0.0651, 0.0659], [ 0.0254, 0.0222, 0.0017, -0.0722, 0.0667], [ 0.0357, -0.0677, 0.0085, -0.0005, -0.0313], [ 0.0672, -0.0359, -0.0243, -0.0811, -0.0726], [ 0.0011, 0.0226, 0.0278, -0.0615, -0.0410]], [[ 0.0202, 0.0519, 0.0527, -0.0086, -0.0683], [ 0.0694, 0.0434, 0.0746, 0.0754, 0.0073], [ 0.0036, -0.0692, -0.0732, -0.0250, -0.0470], [-0.0669, 0.0609, 0.0649, -0.0158, 0.0189], [-0.0564, 0.0370, 0.0464, -0.0530, 0.0487]], [[ 0.0068, 0.0722, 0.0629, -0.0214, 0.0673], [-0.0384, 0.0799, -0.0350, 0.0816, 0.0586], [-0.0111, 0.0696, 0.0145, -0.0397, -0.0784], [-0.0120, 0.0555, 0.0021, -0.0494, -0.0344], [-0.0335, 0.0502, -0.0490, -0.0701, 0.0135]], [[-0.0365, 0.0733, 0.0610, 0.0028, 0.0292], [ 0.0552, -0.0674, 0.0176, -0.0131, 0.0688], [ 0.0147, -0.0432, 0.0473, -0.0231, -0.0314], [-0.0194, 0.0508, -0.0475, 0.0599, 0.0286], [ 0.0055, 0.0287, -0.0391, -0.0543, 0.0778]], [[-0.0241, -0.0322, 0.0704, -0.0758, -0.0562], [-0.0675, -0.0265, -0.0444, -0.0370, 0.0581], [-0.0577, 0.0462, 0.0165, 0.0146, -0.0317], [ 0.0047, 0.0666, -0.0365, 0.0749, 0.0677], [ 0.0557, 0.0098, 0.0451, 0.0306, -0.0628]], [[ 0.0529, 0.0167, 0.0501, 0.0679, 0.0505], [-0.0006, -0.0432, -0.0128, 0.0794, -0.0794], [ 0.0016, -0.0504, -0.0252, 0.0266, 0.0635], [ 0.0305, -0.0807, -0.0236, -0.0810, -0.0010], [-0.0423, -0.0285, -0.0559, 0.0560, 0.0796]]], [[[-0.0504, 0.0634, 0.0504, -0.0440, 0.0425], [ 0.0517, -0.0268, -0.0517, 0.0646, 0.0693], [ 0.0566, 0.0194, 0.0426, -0.0787, 0.0163], [-0.0661, -0.0457, 0.0691, -0.0058, -0.0073], [ 0.0794, 0.0645, 0.0367, -0.0625, -0.0731]], [[ 0.0190, 0.0393, 0.0145, -0.0073, 0.0478], [ 0.0405, 0.0038, -0.0349, -0.0022, 0.0202], [ 0.0346, -0.0622, 0.0194, -0.0151, 0.0220], [ 0.0002, -0.0663, 0.0730, -0.0462, -0.0182], [ 0.0311, -0.0079, 0.0720, 0.0517, -0.0601]], [[-0.0039, -0.0102, -0.0599, -0.0220, -0.0467], [-0.0495, -0.0265, 0.0484, 0.0497, 0.0090], [-0.0260, 0.0256, 0.0476, -0.0585, 0.0411], [-0.0505, -0.0447, -0.0002, -0.0121, -0.0170], [ 0.0400, 0.0457, 0.0709, 0.0195, 0.0762]], [[ 0.0732, -0.0100, 0.0115, -0.0046, -0.0133], [ 0.0333, -0.0065, 0.0115, 0.0057, 0.0370], [ 0.0328, -0.0513, 0.0648, 0.0588, 0.0230], [ 0.0154, 0.0261, 0.0579, 0.0118, 0.0050], [ 0.0089, 0.0468, -0.0763, -0.0314, 0.0676]], [[ 0.0428, -0.0646, -0.0339, 0.0185, -0.0042], [-0.0480, 0.0639, -0.0366, -0.0537, 0.0241], [-0.0572, 0.0309, -0.0761, 0.0227, -0.0385], [-0.0546, -0.0338, 0.0277, -0.0650, -0.0081], [ 0.0690, -0.0083, 0.0295, 0.0088, 0.0360]], [[ 0.0514, 0.0622, -0.0556, -0.0048, -0.0279], [ 0.0112, -0.0413, -0.0483, 0.0166, 0.0690], [-0.0433, 0.0410, -0.0335, -0.0458, -0.0055], [ 0.0229, 0.0289, 0.0695, 0.0574, 0.0075], [ 0.0651, -0.0337, -0.0130, -0.0381, 0.0272]]], ..., [[[-0.0538, 0.0321, 0.0302, 0.0222, -0.0062], [ 0.0050, -0.0461, 0.0084, -0.0448, -0.0604], [-0.0457, 0.0455, -0.0773, -0.0437, 0.0446], [ 0.0691, 0.0390, -0.0040, 0.0035, -0.0133], [ 0.0545, 0.0517, -0.0067, 0.0314, -0.0448]], [[ 0.0029, -0.0675, -0.0254, -0.0168, -0.0563], [ 0.0163, -0.0621, -0.0561, -0.0151, -0.0306], [-0.0021, 0.0389, -0.0429, 0.0778, 0.0451], [-0.0578, 0.0123, 0.0049, -0.0728, -0.0408], [ 0.0722, 0.0388, 0.0177, 0.0526, -0.0291]], [[ 0.0369, 0.0502, 0.0646, 0.0388, -0.0091], [ 0.0066, 0.0501, 0.0114, 0.0243, -0.0455], [ 0.0494, 0.0495, -0.0257, 0.0165, -0.0024], [-0.0476, -0.0552, 0.0029, -0.0813, 0.0698], [-0.0704, -0.0590, -0.0641, 0.0284, 0.0578]], [[ 0.0180, 0.0794, -0.0090, -0.0081, 0.0570], [-0.0529, 0.0517, 0.0045, -0.0580, -0.0192], [-0.0289, 0.0261, 0.0107, 0.0180, -0.0062], [-0.0162, 0.0607, 0.0154, 0.0450, 0.0694], [ 0.0324, 0.0418, -0.0199, -0.0357, 0.0104]], [[ 0.0525, -0.0401, 0.0803, -0.0453, -0.0534], [ 0.0628, 0.0120, 0.0147, 0.0294, -0.0351], [ 0.0773, -0.0587, -0.0713, 0.0125, -0.0125], [-0.0288, -0.0623, 0.0547, 0.0390, -0.0603], [ 0.0105, -0.0003, -0.0773, 0.0167, 0.0386]], [[ 0.0721, -0.0047, 0.0238, 0.0489, 0.0183], [-0.0127, -0.0090, -0.0588, 0.0641, 0.0460], [-0.0194, -0.0753, -0.0349, 0.0186, 0.0156], [ 0.0248, -0.0801, -0.0794, 0.0811, 0.0644], [-0.0415, 0.0127, -0.0120, -0.0724, -0.0800]]], [[[-0.0781, 0.0279, 0.0056, -0.0164, -0.0423], [ 0.0446, 0.0030, 0.0590, 0.0276, -0.0720], [ 0.0647, -0.0414, -0.0306, -0.0477, 0.0041], [-0.0647, 0.0124, 0.0166, -0.0592, 0.0164], [ 0.0789, -0.0673, -0.0583, 0.0493, 0.0306]], [[-0.0105, 0.0707, -0.0790, -0.0334, 0.0620], [ 0.0095, 0.0763, 0.0055, -0.0716, -0.0078], [ 0.0141, -0.0645, 0.0380, -0.0282, -0.0557], [ 0.0489, 0.0073, 0.0203, 0.0568, -0.0352], [-0.0299, 0.0681, -0.0300, 0.0178, -0.0101]], [[ 0.0401, -0.0572, 0.0219, 0.0427, 0.0276], [-0.0683, 0.0192, 0.0689, 0.0217, -0.0365], [-0.0140, -0.0361, -0.0562, 0.0528, 0.0029], [ 0.0213, 0.0464, 0.0525, -0.0804, 0.0599], [ 0.0770, -0.0657, 0.0655, 0.0741, 0.0462]], [[ 0.0479, 0.0648, -0.0050, 0.0530, -0.0746], [-0.0671, 0.0635, 0.0360, -0.0642, -0.0573], [ 0.0176, -0.0783, -0.0781, -0.0027, 0.0405], [ 0.0057, -0.0685, 0.0673, 0.0697, -0.0792], [-0.0449, -0.0773, -0.0756, -0.0524, 0.0378]], [[ 0.0201, 0.0407, -0.0442, -0.0007, -0.0174], [-0.0779, 0.0032, -0.0650, 0.0172, -0.0081], [ 0.0796, -0.0781, -0.0364, 0.0141, -0.0198], [ 0.0270, 0.0519, -0.0578, -0.0515, 0.0225], [ 0.0212, 0.0231, 0.0071, 0.0190, 0.0285]], [[ 0.0311, 0.0148, 0.0181, 0.0617, 0.0037], [ 0.0754, -0.0596, -0.0498, 0.0388, -0.0612], [ 0.0318, -0.0068, -0.0725, -0.0671, -0.0531], [ 0.0446, 0.0793, 0.0193, 0.0033, -0.0685], [ 0.0426, 0.0017, 0.0477, 0.0556, 0.0341]]], [[[ 0.0264, 0.0640, 0.0658, -0.0286, 0.0150], [-0.0585, 0.0256, -0.0657, 0.0341, 0.0521], [ 0.0732, 0.0577, -0.0740, 0.0150, 0.0718], [-0.0311, -0.0343, 0.0234, -0.0110, 0.0344], [ 0.0698, -0.0613, -0.0400, 0.0648, 0.0735]], [[-0.0569, 0.0414, 0.0089, 0.0080, -0.0155], [-0.0289, -0.0245, -0.0732, 0.0417, 0.0205], [-0.0235, -0.0650, -0.0624, -0.0615, -0.0798], [ 0.0679, 0.0393, 0.0494, -0.0063, 0.0646], [-0.0303, -0.0782, 0.0025, 0.0761, -0.0034]], [[ 0.0738, -0.0106, 0.0397, -0.0621, -0.0492], [ 0.0518, 0.0812, 0.0331, 0.0730, 0.0802], [-0.0672, -0.0441, -0.0760, 0.0190, -0.0191], [ 0.0746, -0.0377, 0.0753, 0.0669, -0.0648], [-0.0325, -0.0538, 0.0273, -0.0089, 0.0195]], [[-0.0117, 0.0272, 0.0785, 0.0456, -0.0539], [ 0.0032, 0.0351, 0.0479, 0.0014, -0.0471], [ 0.0423, 0.0394, -0.0310, -0.0511, 0.0784], [-0.0053, -0.0243, -0.0048, 0.0709, -0.0030], [ 0.0415, 0.0264, 0.0010, -0.0056, 0.0069]], [[ 0.0320, -0.0181, 0.0360, -0.0439, -0.0279], [ 0.0479, -0.0807, 0.0018, -0.0336, 0.0605], [-0.0263, 0.0114, -0.0287, -0.0145, 0.0242], [ 0.0662, 0.0028, -0.0437, 0.0128, 0.0656], [-0.0760, 0.0179, 0.0657, -0.0070, -0.0182]], [[-0.0080, 0.0249, 0.0577, -0.0293, -0.0743], [ 0.0087, -0.0072, 0.0067, 0.0361, 0.0340], [ 0.0071, -0.0265, -0.0689, -0.0633, -0.0563], [ 0.0011, -0.0760, -0.0101, -0.0151, 0.0370], [-0.0111, 0.0191, -0.0481, 0.0536, -0.0312]]]], requires_grad=True) number: 3 Parameter containing: tensor([ 0.0811, 0.0474, 0.0688, 0.0393, 0.0037, 0.0488, 0.0750, 0.0471, -0.0719, -0.0324, 0.0389, 0.0586, -0.0008, 0.0676, 0.0294, -0.0628], requires_grad=True) number: 4 Parameter containing: tensor([[-0.0475, -0.0082, -0.0437, ..., -0.0330, 0.0490, 0.0475], [-0.0275, 0.0477, -0.0164, ..., -0.0029, 0.0100, -0.0315], [-0.0226, -0.0392, -0.0472, ..., -0.0402, -0.0272, -0.0432], ..., [-0.0246, -0.0008, 0.0447, ..., 0.0406, -0.0298, -0.0262], [ 0.0467, 0.0372, 0.0408, ..., -0.0421, -0.0001, -0.0135], [-0.0282, 0.0223, 0.0194, ..., -0.0097, -0.0319, 0.0396]], requires_grad=True) number: 5 Parameter containing: tensor([ 0.0312, 0.0236, 0.0176, 0.0037, -0.0012, -0.0042, 0.0425, 0.0405, 0.0321, 0.0227, 0.0208, -0.0116, 0.0476, -0.0051, 0.0387, -0.0304, 0.0043, 0.0238, 0.0025, 0.0380, 0.0364, 0.0444, 0.0352, 0.0125, -0.0236, -0.0201, 0.0044, 0.0127, -0.0117, 0.0066, 0.0128, -0.0357, 0.0495, 0.0009, -0.0232, 0.0040, -0.0159, -0.0448, 0.0313, 0.0298, -0.0172, -0.0153, -0.0001, 0.0011, -0.0480, -0.0373, 0.0089, -0.0285, 0.0373, -0.0390, 0.0039, -0.0410, 0.0361, -0.0379, -0.0024, 0.0319, -0.0204, 0.0499, 0.0245, 0.0405, -0.0188, 0.0363, -0.0243, -0.0254, -0.0162, 0.0027, -0.0361, -0.0312, -0.0237, 0.0039, 0.0370, 0.0016, 0.0022, 0.0490, -0.0024, -0.0360, -0.0159, 0.0279, 0.0083, 0.0165, -0.0160, 0.0078, -0.0434, 0.0045, -0.0073, -0.0083, 0.0435, 0.0065, 0.0092, -0.0196, -0.0220, -0.0032, -0.0253, -0.0129, 0.0335, 0.0439, 0.0313, 0.0008, -0.0024, -0.0006, 0.0498, -0.0476, 0.0132, 0.0282, -0.0258, 0.0244, -0.0256, 0.0442, -0.0401, 0.0172, 0.0345, -0.0403, 0.0404, 0.0330, 0.0240, -0.0060, -0.0173, 0.0332, 0.0438, 0.0324], requires_grad=True) number: 6 Parameter containing: tensor([[ 0.0682, 0.0148, 0.0024, ..., -0.0304, -0.0359, 0.0675], [-0.0736, 0.0799, 0.0328, ..., 0.0723, 0.0668, 0.0532], [ 0.0756, 0.0187, -0.0489, ..., 0.0413, -0.0153, 0.0911], ..., [ 0.0413, 0.0286, 0.0177, ..., -0.0861, -0.0364, 0.0363], [-0.0617, -0.0420, -0.0562, ..., -0.0488, 0.0451, -0.0753], [-0.0725, 0.0668, 0.0668, ..., -0.0901, 0.0577, -0.0083]], requires_grad=True) number: 7 Parameter containing: tensor([-0.0349, -0.0341, -0.0790, -0.0458, -0.0911, -0.0866, -0.0378, -0.0243, -0.0168, 0.0630, 0.0241, -0.0474, -0.0521, 0.0237, 0.0651, -0.0527, -0.0368, -0.0609, 0.0420, -0.0536, 0.0297, -0.0591, 0.0113, -0.0748, 0.0217, 0.0540, 0.0677, 0.0161, -0.0137, 0.0009, 0.0039, -0.0293, 0.0421, -0.0546, 0.0261, -0.0099, -0.0604, 0.0771, 0.0284, -0.0701, -0.0909, 0.0134, 0.0243, 0.0267, 0.0157, 0.0064, -0.0422, -0.0399, 0.0850, -0.0752, 0.0048, -0.0739, 0.0360, -0.0775, 0.0242, 0.0187, -0.0077, 0.0587, 0.0575, 0.0811, 0.0098, 0.0193, 0.0817, 0.0226, 0.0253, -0.0416, -0.0515, 0.0295, 0.0209, -0.0443, -0.0472, -0.0393, 0.0170, -0.0864, 0.0637, 0.0264, -0.0822, -0.0534, -0.0441, -0.0410, 0.0409, -0.0429, 0.0747, 0.0825], requires_grad=True) number: 8 Parameter containing: tensor([[ 0.0933, -0.0207, -0.0625, 0.0699, -0.0453, -0.0761, -0.0832, 0.0625, 0.0088, -0.0761, -0.1056, -0.0030, -0.0689, -0.0944, 0.0860, 0.0847, 0.0142, -0.0269, 0.0735, -0.0080, -0.0654, 0.0801, -0.0691, 0.0459, 0.0287, 0.0508, -0.0854, 0.0158, -0.0010, -0.0982, 0.1022, 0.0983, -0.0577, 0.0037, -0.0862, 0.0950, 0.0595, -0.0366, -0.0567, -0.0346, 0.0438, 0.0595, -0.0157, -0.0865, -0.0474, 0.0600, 0.0583, -0.0653, 0.0962, -0.0919, -0.0094, -0.0529, 0.0105, -0.0262, -0.0430, -0.0617, 0.0215, -0.0279, -0.0643, -0.0058, 0.0924, -0.0948, 0.0948, 0.1033, -0.0855, 0.0897, -0.0782, 0.0540, -0.0881, -0.0235, 0.0202, 0.0043, 0.0427, 0.0609, 0.0642, 0.0931, -0.0185, -0.0504, -0.0069, 0.0574, -0.0265, -0.0505, 0.0262, 0.0494], [-0.0647, 0.0410, -0.0029, 0.0659, 0.0350, -0.0190, 0.0848, 0.0323, 0.0249, -0.0729, -0.0899, 0.0368, 0.0960, -0.0329, -0.0825, -0.0920, -0.0124, -0.0553, -0.1004, -0.0076, 0.0704, -0.0279, 0.0950, 0.0774, -0.0640, -0.0858, -0.0032, 0.0328, -0.0961, 0.0209, 0.0067, -0.0628, 0.1069, 0.0609, -0.0934, -0.0328, 0.0601, 0.0520, 0.0434, -0.1076, 0.0327, 0.0708, 0.0961, 0.0427, -0.0130, -0.0341, -0.0425, -0.1044, -0.0677, -0.0760, -0.0531, 0.0128, 0.0123, -0.1091, 0.0852, -0.0368, 0.0506, -0.0759, 0.0528, 0.0647, 0.0838, -0.0256, 0.0565, 0.0753, -0.0559, 0.0647, -0.0420, -0.0116, -0.0191, -0.0427, 0.0681, -0.0582, 0.0391, -0.0757, 0.0098, 0.0503, 0.0191, -0.0063, -0.0429, -0.0566, -0.0739, -0.0428, 0.0544, 0.0183], [ 0.0067, 0.0380, -0.0176, -0.0715, -0.0549, 0.0962, 0.0355, -0.0906, 0.0202, 0.0709, 0.0023, 0.0755, -0.0993, 0.0541, -0.0550, 0.0248, -0.0932, -0.0260, 0.1029, -0.0231, -0.0964, -0.0891, -0.0211, -0.0722, 0.0446, 0.0500, 0.0587, 0.0497, -0.1061, -0.0997, -0.0102, 0.0313, 0.0623, 0.0050, -0.0069, 0.0673, -0.0658, 0.1083, -0.0012, 0.0709, -0.0975, -0.0847, 0.0578, 0.0997, -0.0887, 0.0487, 0.0191, -0.0873, -0.0008, -0.0942, -0.0485, 0.0261, -0.0089, 0.0594, -0.0690, 0.0987, 0.0836, -0.0318, 0.0439, 0.0591, 0.0820, 0.0010, -0.0838, 0.0104, -0.0534, -0.0732, -0.0150, 0.0793, 0.0686, -0.0508, 0.0454, 0.0869, 0.0133, 0.0598, -0.0043, -0.0390, 0.0614, -0.0297, 0.0352, 0.0652, -0.0774, -0.0156, -0.0226, 0.0355], [ 0.0012, -0.0315, 0.0838, 0.0080, 0.0325, 0.0805, -0.0054, -0.0746, -0.0250, -0.0120, -0.0037, -0.0950, 0.0746, 0.0066, -0.1013, 0.0301, -0.0776, -0.0181, 0.0938, 0.0627, 0.0888, -0.0217, 0.1007, -0.0174, 0.0960, -0.0866, -0.0873, 0.0747, 0.0552, -0.0443, 0.0784, 0.1001, -0.0328, 0.0386, 0.0802, 0.0276, -0.0714, 0.0509, -0.0348, -0.0464, 0.0676, 0.0938, 0.0685, -0.0985, 0.0432, -0.0987, -0.0563, 0.0582, -0.0138, 0.0509, 0.0392, 0.0908, 0.0376, -0.0579, 0.1034, 0.0461, -0.0510, 0.0745, -0.0447, 0.0248, -0.1040, -0.0600, -0.0639, -0.0350, -0.0812, 0.0287, -0.0342, 0.0274, 0.0212, 0.0190, 0.0673, -0.0570, -0.0320, -0.0476, -0.0152, 0.0154, 0.0199, -0.0973, 0.0614, -0.0794, 0.0210, -0.0102, -0.0125, 0.1074], [ 0.1063, -0.1013, 0.0380, -0.0271, -0.0457, 0.0205, -0.0071, 0.0985, 0.0569, -0.0283, 0.0494, -0.0548, 0.0142, 0.0047, 0.0646, -0.0903, -0.0089, -0.0945, 0.0050, -0.0304, -0.0058, 0.0833, -0.1055, 0.0071, 0.0397, -0.0592, -0.0156, -0.0940, -0.0198, 0.0241, -0.0241, -0.0299, -0.0764, 0.0725, 0.0215, -0.0002, 0.0380, 0.0081, 0.0422, -0.0312, -0.0346, 0.0854, -0.0751, 0.0749, -0.0767, 0.0197, 0.0360, 0.0932, 0.0818, -0.0416, -0.0079, -0.0982, -0.1081, 0.1002, 0.0007, 0.0047, 0.0829, -0.0354, -0.0034, 0.0529, -0.0712, 0.0277, 0.0826, -0.0883, -0.0738, 0.0713, 0.0276, -0.0088, 0.1027, 0.0437, 0.0649, -0.0988, 0.0022, 0.0367, -0.0122, 0.1037, 0.0424, 0.0078, 0.0673, -0.0672, 0.0365, -0.0655, -0.0897, -0.0060], [ 0.0624, -0.1046, 0.0262, -0.1060, -0.0777, 0.0284, -0.0273, -0.0677, 0.0551, 0.0854, -0.1024, -0.0598, -0.0534, -0.0248, -0.0260, 0.0670, -0.0736, 0.0003, 0.0888, 0.0071, 0.0255, -0.0868, 0.0522, -0.1004, -0.0999, 0.0138, 0.0931, 0.0567, 0.0954, 0.0333, -0.0543, -0.0247, 0.1058, 0.0855, -0.0132, -0.0682, -0.0004, 0.0740, -0.0042, 0.0707, 0.0549, -0.0046, -0.0439, -0.0504, 0.0302, 0.1058, 0.0606, -0.0812, -0.0082, -0.0801, -0.0320, 0.0691, 0.0740, -0.0344, -0.0354, 0.0713, -0.0984, -0.0976, -0.0726, -0.0398, 0.0096, 0.0115, -0.0570, 0.0385, -0.0697, -0.0370, 0.0772, -0.1068, 0.0097, -0.0927, 0.0767, 0.0889, -0.0755, 0.0978, -0.0471, -0.0240, -0.0996, -0.1091, 0.0211, -0.0500, 0.0238, 0.0725, 0.0794, -0.0496], [-0.0850, 0.0658, -0.0064, 0.0097, 0.0650, 0.0075, -0.0627, -0.0538, -0.0123, 0.1041, -0.0837, -0.0620, 0.0620, 0.0814, -0.0696, -0.0535, 0.0680, -0.0468, -0.0347, -0.0950, -0.0020, -0.0560, -0.0118, 0.0160, 0.0525, -0.0800, 0.0152, 0.0780, 0.0692, 0.0145, 0.0298, 0.0668, -0.0857, 0.0379, 0.0262, -0.0240, -0.0002, 0.0358, 0.1027, -0.0882, -0.0120, -0.0364, 0.0450, -0.0409, 0.0734, -0.0147, 0.0104, -0.0638, -0.0831, 0.0770, -0.0336, -0.0944, 0.0570, -0.0359, -0.0376, -0.0563, 0.0341, -0.0075, -0.0501, 0.0724, -0.0501, -0.0783, 0.0453, -0.0150, -0.0106, 0.0109, -0.0479, 0.0527, -0.0272, 0.0638, -0.0136, -0.0106, 0.0710, 0.0281, -0.0600, 0.0202, -0.0595, -0.1032, 0.0891, 0.0308, 0.0624, 0.0160, 0.0935, -0.0290], [-0.0420, 0.0642, 0.0096, 0.0056, -0.0954, -0.0231, 0.0536, 0.0239, 0.0520, 0.0656, 0.0722, -0.0495, 0.0226, 0.0359, 0.0317, 0.0162, -0.0188, -0.0342, -0.0720, 0.1008, -0.0424, -0.0066, -0.0008, 0.0624, 0.0443, -0.0553, 0.0651, 0.0434, -0.0318, -0.0192, -0.1064, -0.0319, -0.0928, 0.0799, 0.0007, -0.0114, -0.0520, 0.0240, 0.0953, -0.0619, -0.0639, 0.0366, -0.0255, -0.0736, -0.0933, -0.0315, -0.1080, -0.1062, 0.0589, 0.0623, 0.0540, 0.0721, -0.0768, 0.0105, -0.0027, 0.0621, -0.0751, 0.0233, -0.0751, -0.0806, -0.0826, 0.0300, -0.0291, 0.0383, -0.0808, 0.1007, -0.0543, 0.0035, -0.0561, 0.0085, -0.0836, -0.1047, 0.0627, -0.1059, 0.0810, -0.0403, -0.0432, -0.1090, 0.0539, 0.0472, 0.0431, -0.0725, 0.0756, 0.0827], [-0.0824, -0.0121, -0.0877, 0.1064, 0.0574, 0.0816, -0.0948, -0.0348, -0.0750, 0.0935, -0.0948, 0.0401, -0.0775, 0.0102, -0.1091, -0.0275, 0.0953, 0.0511, 0.0871, 0.1013, -0.0493, 0.0454, -0.0099, -0.0197, 0.0263, -0.0975, -0.0862, -0.0693, 0.0910, -0.0355, -0.0826, -0.0047, -0.0917, 0.0405, 0.0405, 0.1026, 0.0680, 0.0931, -0.1053, -0.0651, -0.0820, 0.0002, 0.0001, -0.0373, -0.1021, -0.1002, 0.0142, 0.0693, -0.0751, -0.0405, -0.0484, -0.0259, 0.0772, 0.0777, 0.0067, -0.0434, -0.0317, 0.0415, -0.0672, 0.1077, 0.0045, 0.0755, 0.0651, 0.0079, -0.0981, -0.0223, 0.0464, 0.0021, 0.0144, -0.0223, -0.0271, 0.0137, -0.0451, -0.0577, -0.0458, 0.0913, 0.0558, 0.0918, 0.0410, -0.0722, -0.0629, -0.0514, -0.0731, -0.0570], [ 0.1043, 0.1052, 0.0250, -0.0043, 0.0986, -0.0534, -0.1024, 0.0554, -0.0078, -0.0471, 0.0544, 0.0681, -0.0622, -0.0091, 0.0758, 0.0934, -0.0542, -0.0845, -0.0403, -0.1076, -0.0085, 0.0910, -0.0098, 0.0186, -0.0303, 0.0304, -0.0351, -0.0248, 0.0187, -0.0322, -0.0920, 0.0445, -0.0500, 0.0889, 0.0710, 0.0989, 0.0297, -0.0436, 0.0269, -0.0728, -0.0240, 0.0733, 0.0580, 0.0733, 0.0953, -0.0651, -0.0860, 0.0124, 0.1046, 0.0657, -0.0190, -0.0595, 0.0981, 0.1066, -0.0814, -0.0410, -0.0362, 0.0359, -0.0863, -0.0438, 0.0252, 0.0351, 0.1041, -0.0746, 0.0200, 0.0790, -0.1074, 0.0858, -0.0384, -0.0569, 0.0093, 0.1086, 0.0327, 0.0278, -0.0765, -0.0221, 0.0803, 0.0598, -0.0706, 0.0766, 0.0773, -0.0794, -0.0625, -0.0219]], requires_grad=True) number: 9 Parameter containing: tensor([-0.1061, -0.0962, 0.0518, 0.0545, -0.0188, -0.0293, -0.0951, 0.0373, -0.0218, -0.0068], requires_grad=True)
以上这篇Pytorch之parameters的使用就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。