pytorch-04.反向传播(作业)

'''
y^ = w1*x^2 + w2*x + b
'''
import torch

x_data = [1.0,2.0,3.0]
y_data = [2.0,4.0,6.0]

w1 = torch.Tensor([1.0])
w1.requires_grad = True

w2 = torch.Tensor([1.0])
w2.requires_grad = True

b = torch.Tensor([1.0])
b.requires_grad = True

def forward(x):
    return w1*x**2 + w2*x + b

def loss(x,y):
    y_pred = forward(x)
    return (y_pred - y)**2

print('Predict (before training)',4,forward(4))

for epoch in range(100):
    for x,y in zip(x_data,y_data):
        l = loss(x,y)
        l.backward()
        print('\tgrad: w1:',w1.grad.item(),"w2:",w2.grad.item())
        w1.data = w1.data - 0.01*w1.grad.data
        w2.data = w2.data - 0.01 * w2.grad.data
        print('\t w1:',w1,"w2:",w2)

        w1.grad.data.zero_()
        w2.grad.data.zero_()

    print('progress:',epoch,l.item())

print('Predict(after training)',4,forward(4).item())



结果:

Predict (before training) 4 tensor([21.], grad_fn=<AddBackward0>)
    grad: w1: 2.0 w2: 2.0
     w1: tensor([0.9800], requires_grad=True) w2: tensor([0.9800], requires_grad=True)
    grad: w1: 23.040000915527344 w2: 11.520000457763672
     w1: tensor([0.7496], requires_grad=True) w2: tensor([0.8648], requires_grad=True)
    grad: w1: 78.13440704345703 w2: 26.044801712036133
     w1: tensor([-0.0317], requires_grad=True) w2: tensor([0.6044], requires_grad=True)
progress: 0 18.842546463012695
    grad: w1: -0.8547840118408203 w2: -0.8547840118408203
     w1: tensor([-0.0232], requires_grad=True) w2: tensor([0.6129], requires_grad=True)
    grad: w1: -14.935882568359375 w2: -7.4679412841796875
     w1: tensor([0.1262], requires_grad=True) w2: tensor([0.6876], requires_grad=True)
    grad: w1: -32.43238067626953 w2: -10.810792922973633
     w1: tensor([0.4505], requires_grad=True) w2: tensor([0.7957], requires_grad=True)
progress: 1 3.246479034423828
    grad: w1: 0.49234724044799805 w2: 0.49234724044799805
     w1: tensor([0.4456], requires_grad=True) w2: tensor([0.7908], requires_grad=True)
    grad: w1: 2.9102325439453125 w2: 1.4551162719726562
     w1: tensor([0.4165], requires_grad=True) w2: tensor([0.7762], requires_grad=True)
    grad: w1: 19.382097244262695 w2: 6.460699081420898
     w1: tensor([0.2226], requires_grad=True) w2: tensor([0.7116], requires_grad=True)
progress: 2 1.1594619750976562
    grad: w1: -0.13150930404663086 w2: -0.13150930404663086
     w1: tensor([0.2240], requires_grad=True) w2: tensor([0.7129], requires_grad=True)
    grad: w1: -5.426715850830078 w2: -2.713357925415039
     w1: tensor([0.2782], requires_grad=True) w2: tensor([0.7401], requires_grad=True)
    grad: w1: -4.965116500854492 w2: -1.655038833618164
     w1: tensor([0.3279], requires_grad=True) w2: tensor([0.7566], requires_grad=True)
progress: 3 0.0760876014828682
    grad: w1: 0.16895580291748047 w2: 0.16895580291748047
     w1: tensor([0.3262], requires_grad=True) w2: tensor([0.7549], requires_grad=True)
    grad: w1: -1.4834861755371094 w2: -0.7417430877685547
     w1: tensor([0.3410], requires_grad=True) w2: tensor([0.7623], requires_grad=True)
    grad: w1: 6.4109344482421875 w2: 2.1369781494140625
     w1: tensor([0.2769], requires_grad=True) w2: tensor([0.7410], requires_grad=True)
progress: 4 0.1268520951271057
    grad: w1: 0.03574371337890625 w2: 0.03574371337890625
     w1: tensor([0.2766], requires_grad=True) w2: tensor([0.7406], requires_grad=True)
    grad: w1: -3.3006629943847656 w2: -1.6503314971923828
     w1: tensor([0.3096], requires_grad=True) w2: tensor([0.7571], requires_grad=True)
    grad: w1: 1.0323028564453125 w2: 0.3441009521484375
     w1: tensor([0.2992], requires_grad=True) w2: tensor([0.7537], requires_grad=True)
progress: 5 0.003289040643721819
    grad: w1: 0.10580587387084961 w2: 0.10580587387084961
     w1: tensor([0.2982], requires_grad=True) w2: tensor([0.7526], requires_grad=True)
    grad: w1: -2.416576385498047 w2: -1.2082881927490234
     w1: tensor([0.3223], requires_grad=True) w2: tensor([0.7647], requires_grad=True)
    grad: w1: 3.5129470825195312 w2: 1.1709823608398438
     w1: tensor([0.2872], requires_grad=True) w2: tensor([0.7530], requires_grad=True)
progress: 6 0.038088880479335785
    grad: w1: 0.08039236068725586 w2: 0.08039236068725586
     w1: tensor([0.2864], requires_grad=True) w2: tensor([0.7522], requires_grad=True)
    grad: w1: -2.8000354766845703 w2: -1.4000177383422852
     w1: tensor([0.3144], requires_grad=True) w2: tensor([0.7662], requires_grad=True)
    grad: w1: 2.3080644607543945 w2: 0.7693548202514648
     w1: tensor([0.2913], requires_grad=True) w2: tensor([0.7585], requires_grad=True)
progress: 7 0.01644185744225979
    grad: w1: 0.09962940216064453 w2: 0.09962940216064453
     w1: tensor([0.2903], requires_grad=True) w2: tensor([0.7575], requires_grad=True)
    grad: w1: -2.589519500732422 w2: -1.294759750366211
     w1: tensor([0.3162], requires_grad=True) w2: tensor([0.7704], requires_grad=True)
    grad: w1: 2.8325414657592773 w2: 0.9441804885864258
     w1: tensor([0.2879], requires_grad=True) w2: tensor([0.7610], requires_grad=True)
progress: 8 0.02476324513554573
    grad: w1: 0.09779548645019531 w2: 0.09779548645019531
     w1: tensor([0.2869], requires_grad=True) w2: tensor([0.7600], requires_grad=True)
    grad: w1: -2.6581344604492188 w2: -1.3290672302246094
     w1: tensor([0.3135], requires_grad=True) w2: tensor([0.7733], requires_grad=True)
    grad: w1: 2.546605110168457 w2: 0.8488683700561523
     w1: tensor([0.2880], requires_grad=True) w2: tensor([0.7648], requires_grad=True)
progress: 9 0.02001604251563549
    grad: w1: 0.10571813583374023 w2: 0.10571813583374023
     w1: tensor([0.2870], requires_grad=True) w2: tensor([0.7638], requires_grad=True)
    grad: w1: -2.5963592529296875 w2: -1.2981796264648438
     w1: tensor([0.3129], requires_grad=True) w2: tensor([0.7767], requires_grad=True)
    grad: w1: 2.641490936279297 w2: 0.8804969787597656
     w1: tensor([0.2865], requires_grad=True) w2: tensor([0.7679], requires_grad=True)
progress: 10 0.021535415202379227
    grad: w1: 0.10894012451171875 w2: 0.10894012451171875
     w1: tensor([0.2854], requires_grad=True) w2: tensor([0.7668], requires_grad=True)
    grad: w1: -2.596263885498047 w2: -1.2981319427490234
     w1: tensor([0.3114], requires_grad=True) w2: tensor([0.7798], requires_grad=True)
    grad: w1: 2.5584325790405273 w2: 0.8528108596801758
     w1: tensor([0.2858], requires_grad=True) w2: tensor([0.7713], requires_grad=True)
progress: 11 0.0202023983001709
    grad: w1: 0.11424589157104492 w2: 0.11424589157104492
     w1: tensor([0.2847], requires_grad=True) w2: tensor([0.7702], requires_grad=True)
    grad: w1: -2.5677433013916016 w2: -1.2838716506958008
     w1: tensor([0.3104], requires_grad=True) w2: tensor([0.7830], requires_grad=True)
    grad: w1: 2.5595226287841797 w2: 0.8531742095947266
     w1: tensor([0.2848], requires_grad=True) w2: tensor([0.7745], requires_grad=True)
progress: 12 0.02021961845457554
    grad: w1: 0.1184544563293457 w2: 0.1184544563293457
     w1: tensor([0.2836], requires_grad=True) w2: tensor([0.7733], requires_grad=True)
    grad: w1: -2.553058624267578 w2: -1.276529312133789
     w1: tensor([0.3091], requires_grad=True) w2: tensor([0.7860], requires_grad=True)
    grad: w1: 2.521791458129883 w2: 0.8405971527099609
     w1: tensor([0.2839], requires_grad=True) w2: tensor([0.7776], requires_grad=True)
progress: 13 0.019627876579761505
    grad: w1: 0.12306022644042969 w2: 0.12306022644042969
     w1: tensor([0.2827], requires_grad=True) w2: tensor([0.7764], requires_grad=True)
    grad: w1: -2.5323734283447266 w2: -1.2661867141723633
     w1: tensor([0.3080], requires_grad=True) w2: tensor([0.7891], requires_grad=True)
    grad: w1: 2.5029430389404297 w2: 0.8343143463134766
     w1: tensor([0.2830], requires_grad=True) w2: tensor([0.7807], requires_grad=True)
progress: 14 0.019335567951202393
    grad: w1: 0.1273636817932129 w2: 0.1273636817932129
     w1: tensor([0.2817], requires_grad=True) w2: tensor([0.7795], requires_grad=True)
    grad: w1: -2.5149898529052734 w2: -1.2574949264526367
     w1: tensor([0.3068], requires_grad=True) w2: tensor([0.7920], requires_grad=True)
    grad: w1: 2.475889205932617 w2: 0.8252964019775391
     w1: tensor([0.2821], requires_grad=True) w2: tensor([0.7838], requires_grad=True)
progress: 15 0.01891983672976494
    grad: w1: 0.13169527053833008 w2: 0.13169527053833008
     w1: tensor([0.2808], requires_grad=True) w2: tensor([0.7825], requires_grad=True)
    grad: w1: -2.496540069580078 w2: -1.248270034790039
     w1: tensor([0.3057], requires_grad=True) w2: tensor([0.7949], requires_grad=True)
    grad: w1: 2.4532814025878906 w2: 0.8177604675292969
     w1: tensor([0.2812], requires_grad=True) w2: tensor([0.7868], requires_grad=True)
progress: 16 0.018575893715023994
    grad: w1: 0.13590288162231445 w2: 0.13590288162231445
     w1: tensor([0.2798], requires_grad=True) w2: tensor([0.7854], requires_grad=True)
    grad: w1: -2.4790496826171875 w2: -1.2395248413085938
     w1: tensor([0.3046], requires_grad=True) w2: tensor([0.7978], requires_grad=True)
    grad: w1: 2.429231643676758 w2: 0.8097438812255859
     w1: tensor([0.2803], requires_grad=True) w2: tensor([0.7897], requires_grad=True)
progress: 17 0.018213476985692978
    grad: w1: 0.1400585174560547 w2: 0.1400585174560547
     w1: tensor([0.2789], requires_grad=True) w2: tensor([0.7883], requires_grad=True)
    grad: w1: -2.4615707397460938 w2: -1.2307853698730469
     w1: tensor([0.3035], requires_grad=True) w2: tensor([0.8006], requires_grad=True)
    grad: w1: 2.406452178955078 w2: 0.8021507263183594
     w1: tensor([0.2795], requires_grad=True) w2: tensor([0.7926], requires_grad=True)
progress: 18 0.0178734939545393
    grad: w1: 0.14413166046142578 w2: 0.14413166046142578
     w1: tensor([0.2780], requires_grad=True) w2: tensor([0.7911], requires_grad=True)
    grad: w1: -2.4445343017578125 w2: -1.2222671508789062
     w1: tensor([0.3025], requires_grad=True) w2: tensor([0.8034], requires_grad=True)
    grad: w1: 2.383681297302246 w2: 0.794560432434082
     w1: tensor([0.2786], requires_grad=True) w2: tensor([0.7954], requires_grad=True)
progress: 19 0.017536841332912445
    grad: w1: 0.14813709259033203 w2: 0.14813709259033203
     w1: tensor([0.2772], requires_grad=True) w2: tensor([0.7939], requires_grad=True)
    grad: w1: -2.427734375 w2: -1.2138671875
     w1: tensor([0.3014], requires_grad=True) w2: tensor([0.8061], requires_grad=True)
    grad: w1: 2.3614940643310547 w2: 0.7871646881103516
     w1: tensor([0.2778], requires_grad=True) w2: tensor([0.7982], requires_grad=True)
progress: 20 0.017211895436048508
    grad: w1: 0.1520709991455078 w2: 0.1520709991455078
     w1: tensor([0.2763], requires_grad=True) w2: tensor([0.7967], requires_grad=True)
    grad: w1: -2.4112586975097656 w2: -1.2056293487548828
     w1: tensor([0.3004], requires_grad=True) w2: tensor([0.8087], requires_grad=True)
    grad: w1: 2.3396072387695312 w2: 0.7798690795898438
     w1: tensor([0.2770], requires_grad=True) w2: tensor([0.8009], requires_grad=True)
progress: 21 0.016894327476620674
    grad: w1: 0.15593624114990234 w2: 0.15593624114990234
     w1: tensor([0.2755], requires_grad=True) w2: tensor([0.7994], requires_grad=True)
    grad: w1: -2.3950576782226562 w2: -1.1975288391113281
     w1: tensor([0.2994], requires_grad=True) w2: tensor([0.8114], requires_grad=True)
    grad: w1: 2.3181495666503906 w2: 0.7727165222167969
     w1: tensor([0.2762], requires_grad=True) w2: tensor([0.8036], requires_grad=True)
progress: 22 0.016585856676101685
    grad: w1: 0.15973281860351562 w2: 0.15973281860351562
     w1: tensor([0.2746], requires_grad=True) w2: tensor([0.8020], requires_grad=True)
    grad: w1: -2.379150390625 w2: -1.1895751953125
     w1: tensor([0.2984], requires_grad=True) w2: tensor([0.8139], requires_grad=True)
    grad: w1: 2.2970523834228516 w2: 0.7656841278076172
     w1: tensor([0.2755], requires_grad=True) w2: tensor([0.8063], requires_grad=True)
progress: 23 0.016285337507724762
    grad: w1: 0.16346359252929688 w2: 0.16346359252929688
     w1: tensor([0.2738], requires_grad=True) w2: tensor([0.8046], requires_grad=True)
    grad: w1: -2.3635177612304688 w2: -1.1817588806152344
     w1: tensor([0.2975], requires_grad=True) w2: tensor([0.8165], requires_grad=True)
    grad: w1: 2.2763242721557617 w2: 0.7587747573852539
     w1: tensor([0.2747], requires_grad=True) w2: tensor([0.8089], requires_grad=True)
progress: 24 0.015992753207683563
    grad: w1: 0.1671285629272461 w2: 0.1671285629272461
     w1: tensor([0.2730], requires_grad=True) w2: tensor([0.8072], requires_grad=True)
    grad: w1: -2.3481597900390625 w2: -1.1740798950195312
     w1: tensor([0.2965], requires_grad=True) w2: tensor([0.8189], requires_grad=True)
    grad: w1: 2.255965232849121 w2: 0.751988410949707
     w1: tensor([0.2739], requires_grad=True) w2: tensor([0.8114], requires_grad=True)
progress: 25 0.015707960352301598
    grad: w1: 0.1707291603088379 w2: 0.1707291603088379
     w1: tensor([0.2722], requires_grad=True) w2: tensor([0.8097], requires_grad=True)
    grad: w1: -2.3330726623535156 w2: -1.1665363311767578
     w1: tensor([0.2956], requires_grad=True) w2: tensor([0.8214], requires_grad=True)
    grad: w1: 2.2359580993652344 w2: 0.7453193664550781
     w1: tensor([0.2732], requires_grad=True) w2: tensor([0.8139], requires_grad=True)
progress: 26 0.015430581755936146
    grad: w1: 0.17426681518554688 w2: 0.17426681518554688
     w1: tensor([0.2715], requires_grad=True) w2: tensor([0.8122], requires_grad=True)
    grad: w1: -2.3182506561279297 w2: -1.1591253280639648
     w1: tensor([0.2946], requires_grad=True) w2: tensor([0.8238], requires_grad=True)
    grad: w1: 2.216320037841797 w2: 0.7387733459472656
     w1: tensor([0.2725], requires_grad=True) w2: tensor([0.8164], requires_grad=True)
progress: 27 0.015160723589360714
    grad: w1: 0.17774152755737305 w2: 0.17774152755737305
     w1: tensor([0.2707], requires_grad=True) w2: tensor([0.8146], requires_grad=True)
    grad: w1: -2.303691864013672 w2: -1.151845932006836
     w1: tensor([0.2937], requires_grad=True) w2: tensor([0.8261], requires_grad=True)
    grad: w1: 2.196990966796875 w2: 0.732330322265625
     w1: tensor([0.2718], requires_grad=True) w2: tensor([0.8188], requires_grad=True)
progress: 28 0.014897435903549194
    grad: w1: 0.18115615844726562 w2: 0.18115615844726562
     w1: tensor([0.2700], requires_grad=True) w2: tensor([0.8170], requires_grad=True)
    grad: w1: -2.2893810272216797 w2: -1.1446905136108398
     w1: tensor([0.2929], requires_grad=True) w2: tensor([0.8284], requires_grad=True)
    grad: w1: 2.17803955078125 w2: 0.72601318359375
     w1: tensor([0.2711], requires_grad=True) w2: tensor([0.8212], requires_grad=True)
progress: 29 0.014641531743109226
    grad: w1: 0.1845102310180664 w2: 0.1845102310180664
     w1: tensor([0.2692], requires_grad=True) w2: tensor([0.8193], requires_grad=True)
    grad: w1: -2.27532958984375 w2: -1.137664794921875
     w1: tensor([0.2920], requires_grad=True) w2: tensor([0.8307], requires_grad=True)
    grad: w1: 2.1593971252441406 w2: 0.7197990417480469
     w1: tensor([0.2704], requires_grad=True) w2: tensor([0.8235], requires_grad=True)
progress: 30 0.014391962438821793
    grad: w1: 0.1878056526184082 w2: 0.1878056526184082
     w1: tensor([0.2685], requires_grad=True) w2: tensor([0.8216], requires_grad=True)
    grad: w1: -2.2615184783935547 w2: -1.1307592391967773
     w1: tensor([0.2911], requires_grad=True) w2: tensor([0.8329], requires_grad=True)
    grad: w1: 2.1410980224609375 w2: 0.7136993408203125
     w1: tensor([0.2697], requires_grad=True) w2: tensor([0.8258], requires_grad=True)
progress: 31 0.0141490763053298
    grad: w1: 0.19104290008544922 w2: 0.19104290008544922
     w1: tensor([0.2678], requires_grad=True) w2: tensor([0.8239], requires_grad=True)
    grad: w1: -2.247955322265625 w2: -1.1239776611328125
     w1: tensor([0.2903], requires_grad=True) w2: tensor([0.8351], requires_grad=True)
    grad: w1: 2.12310791015625 w2: 0.70770263671875
     w1: tensor([0.2691], requires_grad=True) w2: tensor([0.8281], requires_grad=True)
progress: 32 0.013912306167185307
    grad: w1: 0.19422388076782227 w2: 0.19422388076782227
     w1: tensor([0.2671], requires_grad=True) w2: tensor([0.8261], requires_grad=True)
    grad: w1: -2.2346267700195312 w2: -1.1173133850097656
     w1: tensor([0.2895], requires_grad=True) w2: tensor([0.8373], requires_grad=True)
    grad: w1: 2.105426788330078 w2: 0.7018089294433594
     w1: tensor([0.2684], requires_grad=True) w2: tensor([0.8303], requires_grad=True)
progress: 33 0.013681549578905106
    grad: w1: 0.19734907150268555 w2: 0.19734907150268555
     w1: tensor([0.2664], requires_grad=True) w2: tensor([0.8283], requires_grad=True)
    grad: w1: -2.2215309143066406 w2: -1.1107654571533203
     w1: tensor([0.2886], requires_grad=True) w2: tensor([0.8394], requires_grad=True)
    grad: w1: 2.088080406188965 w2: 0.6960268020629883
     w1: tensor([0.2678], requires_grad=True) w2: tensor([0.8324], requires_grad=True)
progress: 34 0.013457036577165127
    grad: w1: 0.20041894912719727 w2: 0.20041894912719727
     w1: tensor([0.2658], requires_grad=True) w2: tensor([0.8304], requires_grad=True)
    grad: w1: -2.208667755126953 w2: -1.1043338775634766
     w1: tensor([0.2878], requires_grad=True) w2: tensor([0.8415], requires_grad=True)
    grad: w1: 2.071017265319824 w2: 0.6903390884399414
     w1: tensor([0.2671], requires_grad=True) w2: tensor([0.8346], requires_grad=True)
progress: 35 0.013238001614809036
    grad: w1: 0.20343494415283203 w2: 0.20343494415283203
     w1: tensor([0.2651], requires_grad=True) w2: tensor([0.8325], requires_grad=True)
    grad: w1: -2.1960296630859375 w2: -1.0980148315429688
     w1: tensor([0.2871], requires_grad=True) w2: tensor([0.8435], requires_grad=True)
    grad: w1: 2.054263114929199 w2: 0.6847543716430664
     w1: tensor([0.2665], requires_grad=True) w2: tensor([0.8367], requires_grad=True)
progress: 36 0.013024682179093361
    grad: w1: 0.20639801025390625 w2: 0.20639801025390625
     w1: tensor([0.2645], requires_grad=True) w2: tensor([0.8346], requires_grad=True)
    grad: w1: -2.183614730834961 w2: -1.0918073654174805
     w1: tensor([0.2863], requires_grad=True) w2: tensor([0.8455], requires_grad=True)
    grad: w1: 2.037792205810547 w2: 0.6792640686035156
     w1: tensor([0.2659], requires_grad=True) w2: tensor([0.8387], requires_grad=True)
progress: 37 0.012816657312214375
    grad: w1: 0.20930910110473633 w2: 0.20930910110473633
     w1: tensor([0.2638], requires_grad=True) w2: tensor([0.8367], requires_grad=True)
    grad: w1: -2.1714134216308594 w2: -1.0857067108154297
     w1: tensor([0.2855], requires_grad=True) w2: tensor([0.8475], requires_grad=True)
    grad: w1: 2.02163028717041 w2: 0.6738767623901367
     w1: tensor([0.2653], requires_grad=True) w2: tensor([0.8408], requires_grad=True)
progress: 38 0.01261416357010603
    grad: w1: 0.21216917037963867 w2: 0.21216917037963867
     w1: tensor([0.2632], requires_grad=True) w2: tensor([0.8386], requires_grad=True)
    grad: w1: -2.1594314575195312 w2: -1.0797157287597656
     w1: tensor([0.2848], requires_grad=True) w2: tensor([0.8494], requires_grad=True)
    grad: w1: 2.005734443664551 w2: 0.6685781478881836
     w1: tensor([0.2647], requires_grad=True) w2: tensor([0.8428], requires_grad=True)
progress: 39 0.012416576035320759
    grad: w1: 0.2149791717529297 w2: 0.2149791717529297
     w1: tensor([0.2626], requires_grad=True) w2: tensor([0.8406], requires_grad=True)
    grad: w1: -2.1476593017578125 w2: -1.0738296508789062
     w1: tensor([0.2841], requires_grad=True) w2: tensor([0.8513], requires_grad=True)
    grad: w1: 1.9901304244995117 w2: 0.6633768081665039
     w1: tensor([0.2642], requires_grad=True) w2: tensor([0.8447], requires_grad=True)
progress: 40 0.012224133126437664
    grad: w1: 0.21773910522460938 w2: 0.21773910522460938
     w1: tensor([0.2620], requires_grad=True) w2: tensor([0.8425], requires_grad=True)
    grad: w1: -2.1360912322998047 w2: -1.0680456161499023
     w1: tensor([0.2833], requires_grad=True) w2: tensor([0.8532], requires_grad=True)
    grad: w1: 1.97479248046875 w2: 0.65826416015625
     w1: tensor([0.2636], requires_grad=True) w2: tensor([0.8466], requires_grad=True)
progress: 41 0.01203643623739481
    grad: w1: 0.22045135498046875 w2: 0.22045135498046875
     w1: tensor([0.2614], requires_grad=True) w2: tensor([0.8444], requires_grad=True)
    grad: w1: -2.124727249145508 w2: -1.062363624572754
     w1: tensor([0.2826], requires_grad=True) w2: tensor([0.8551], requires_grad=True)
    grad: w1: 1.9597206115722656 w2: 0.6532402038574219
     w1: tensor([0.2630], requires_grad=True) w2: tensor([0.8485], requires_grad=True)
progress: 42 0.011853409931063652
    grad: w1: 0.2231159210205078 w2: 0.2231159210205078
     w1: tensor([0.2608], requires_grad=True) w2: tensor([0.8463], requires_grad=True)
    grad: w1: -2.1135616302490234 w2: -1.0567808151245117
     w1: tensor([0.2819], requires_grad=True) w2: tensor([0.8569], requires_grad=True)
    grad: w1: 1.9449234008789062 w2: 0.6483078002929688
     w1: tensor([0.2625], requires_grad=True) w2: tensor([0.8504], requires_grad=True)
progress: 43 0.011675083078444004
    grad: w1: 0.22573328018188477 w2: 0.22573328018188477
     w1: tensor([0.2602], requires_grad=True) w2: tensor([0.8481], requires_grad=True)
    grad: w1: -2.1025943756103516 w2: -1.0512971878051758
     w1: tensor([0.2813], requires_grad=True) w2: tensor([0.8586], requires_grad=True)
    grad: w1: 1.9303836822509766 w2: 0.6434612274169922
     w1: tensor([0.2620], requires_grad=True) w2: tensor([0.8522], requires_grad=True)
progress: 44 0.011501176282763481
    grad: w1: 0.22830486297607422 w2: 0.22830486297607422
     w1: tensor([0.2597], requires_grad=True) w2: tensor([0.8499], requires_grad=True)
    grad: w1: -2.0918197631835938 w2: -1.0459098815917969
     w1: tensor([0.2806], requires_grad=True) w2: tensor([0.8604], requires_grad=True)
    grad: w1: 1.9161014556884766 w2: 0.6387004852294922
     w1: tensor([0.2614], requires_grad=True) w2: tensor([0.8540], requires_grad=True)
progress: 45 0.011331619694828987
    grad: w1: 0.23083114624023438 w2: 0.23083114624023438
     w1: tensor([0.2591], requires_grad=True) w2: tensor([0.8517], requires_grad=True)
    grad: w1: -2.0812339782714844 w2: -1.0406169891357422
     w1: tensor([0.2799], requires_grad=True) w2: tensor([0.8621], requires_grad=True)
    grad: w1: 1.9020509719848633 w2: 0.6340169906616211
     w1: tensor([0.2609], requires_grad=True) w2: tensor([0.8557], requires_grad=True)
progress: 46 0.011166042648255825
    grad: w1: 0.23331403732299805 w2: 0.23331403732299805
     w1: tensor([0.2586], requires_grad=True) w2: tensor([0.8534], requires_grad=True)
    grad: w1: -2.070829391479492 w2: -1.035414695739746
     w1: tensor([0.2793], requires_grad=True) w2: tensor([0.8638], requires_grad=True)
    grad: w1: 1.888275146484375 w2: 0.629425048828125
     w1: tensor([0.2604], requires_grad=True) w2: tensor([0.8575], requires_grad=True)
progress: 47 0.011004885658621788
    grad: w1: 0.23575210571289062 w2: 0.23575210571289062
     w1: tensor([0.2581], requires_grad=True) w2: tensor([0.8551], requires_grad=True)
    grad: w1: -2.0606155395507812 w2: -1.0303077697753906
     w1: tensor([0.2787], requires_grad=True) w2: tensor([0.8654], requires_grad=True)
    grad: w1: 1.8747138977050781 w2: 0.6249046325683594
     w1: tensor([0.2599], requires_grad=True) w2: tensor([0.8592], requires_grad=True)
progress: 48 0.010847383178770542
    grad: w1: 0.23814821243286133 w2: 0.23814821243286133
     w1: tensor([0.2575], requires_grad=True) w2: tensor([0.8568], requires_grad=True)
    grad: w1: -2.0505733489990234 w2: -1.0252866744995117
     w1: tensor([0.2780], requires_grad=True) w2: tensor([0.8670], requires_grad=True)
    grad: w1: 1.861410140991211 w2: 0.6204700469970703
     w1: tensor([0.2594], requires_grad=True) w2: tensor([0.8608], requires_grad=True)
progress: 49 0.010693974792957306
    grad: w1: 0.24050188064575195 w2: 0.24050188064575195
     w1: tensor([0.2570], requires_grad=True) w2: tensor([0.8584], requires_grad=True)
    grad: w1: -2.040712356567383 w2: -1.0203561782836914
     w1: tensor([0.2774], requires_grad=True) w2: tensor([0.8686], requires_grad=True)
    grad: w1: 1.8483295440673828 w2: 0.6161098480224609
     w1: tensor([0.2589], requires_grad=True) w2: tensor([0.8625], requires_grad=True)
progress: 50 0.010544204153120518
    grad: w1: 0.2428140640258789 w2: 0.2428140640258789
     w1: tensor([0.2565], requires_grad=True) w2: tensor([0.8600], requires_grad=True)
    grad: w1: -2.0310211181640625 w2: -1.0155105590820312
     w1: tensor([0.2768], requires_grad=True) w2: tensor([0.8702], requires_grad=True)
    grad: w1: 1.835489273071289 w2: 0.6118297576904297
     w1: tensor([0.2585], requires_grad=True) w2: tensor([0.8641], requires_grad=True)
progress: 51 0.01039821282029152
    grad: w1: 0.2450857162475586 w2: 0.2450857162475586
     w1: tensor([0.2560], requires_grad=True) w2: tensor([0.8616], requires_grad=True)
    grad: w1: -2.021503448486328 w2: -1.010751724243164
     w1: tensor([0.2762], requires_grad=True) w2: tensor([0.8717], requires_grad=True)
    grad: w1: 1.8228721618652344 w2: 0.6076240539550781
     w1: tensor([0.2580], requires_grad=True) w2: tensor([0.8657], requires_grad=True)
progress: 52 0.010255749337375164
    grad: w1: 0.24731779098510742 w2: 0.24731779098510742
     w1: tensor([0.2555], requires_grad=True) w2: tensor([0.8632], requires_grad=True)
    grad: w1: -2.0121536254882812 w2: -1.0060768127441406
     w1: tensor([0.2756], requires_grad=True) w2: tensor([0.8732], requires_grad=True)
    grad: w1: 1.810469627380371 w2: 0.603489875793457
     w1: tensor([0.2575], requires_grad=True) w2: tensor([0.8672], requires_grad=True)
progress: 53 0.010116667486727238
    grad: w1: 0.2495102882385254 w2: 0.2495102882385254
     w1: tensor([0.2550], requires_grad=True) w2: tensor([0.8647], requires_grad=True)
    grad: w1: -2.0029640197753906 w2: -1.0014820098876953
     w1: tensor([0.2751], requires_grad=True) w2: tensor([0.8747], requires_grad=True)
    grad: w1: 1.7982730865478516 w2: 0.5994243621826172
     w1: tensor([0.2571], requires_grad=True) w2: tensor([0.8687], requires_grad=True)
progress: 54 0.009980821050703526
    grad: w1: 0.2516651153564453 w2: 0.2516651153564453
     w1: tensor([0.2546], requires_grad=True) w2: tensor([0.8662], requires_grad=True)
    grad: w1: -1.9939346313476562 w2: -0.9969673156738281
     w1: tensor([0.2745], requires_grad=True) w2: tensor([0.8762], requires_grad=True)
    grad: w1: 1.786325454711914 w2: 0.5954418182373047
     w1: tensor([0.2567], requires_grad=True) w2: tensor([0.8702], requires_grad=True)
progress: 55 0.009848637506365776
    grad: w1: 0.2537808418273926 w2: 0.2537808418273926
     w1: tensor([0.2541], requires_grad=True) w2: tensor([0.8677], requires_grad=True)
    grad: w1: -1.9850692749023438 w2: -0.9925346374511719
     w1: tensor([0.2740], requires_grad=True) w2: tensor([0.8776], requires_grad=True)
    grad: w1: 1.7745494842529297 w2: 0.5915164947509766
     w1: tensor([0.2562], requires_grad=True) w2: tensor([0.8717], requires_grad=True)
progress: 56 0.009719215333461761
    grad: w1: 0.2558603286743164 w2: 0.2558603286743164
     w1: tensor([0.2537], requires_grad=True) w2: tensor([0.8691], requires_grad=True)
    grad: w1: -1.9763526916503906 w2: -0.9881763458251953
     w1: tensor([0.2734], requires_grad=True) w2: tensor([0.8790], requires_grad=True)
    grad: w1: 1.7630138397216797 w2: 0.5876712799072266
     w1: tensor([0.2558], requires_grad=True) w2: tensor([0.8732], requires_grad=True)
progress: 57 0.009593265131115913
    grad: w1: 0.2579030990600586 w2: 0.2579030990600586
     w1: tensor([0.2532], requires_grad=True) w2: tensor([0.8706], requires_grad=True)
    grad: w1: -1.9677963256835938 w2: -0.9838981628417969
     w1: tensor([0.2729], requires_grad=True) w2: tensor([0.8804], requires_grad=True)
    grad: w1: 1.7516584396362305 w2: 0.5838861465454102
     w1: tensor([0.2554], requires_grad=True) w2: tensor([0.8746], requires_grad=True)
progress: 58 0.009470084682106972
    grad: w1: 0.25990962982177734 w2: 0.25990962982177734
     w1: tensor([0.2528], requires_grad=True) w2: tensor([0.8720], requires_grad=True)
    grad: w1: -1.9593887329101562 w2: -0.9796943664550781
     w1: tensor([0.2724], requires_grad=True) w2: tensor([0.8818], requires_grad=True)
    grad: w1: 1.740509033203125 w2: 0.580169677734375
     w1: tensor([0.2550], requires_grad=True) w2: tensor([0.8760], requires_grad=True)
progress: 59 0.009349912405014038
    grad: w1: 0.26188182830810547 w2: 0.26188182830810547
     w1: tensor([0.2524], requires_grad=True) w2: tensor([0.8734], requires_grad=True)
    grad: w1: -1.9511260986328125 w2: -0.9755630493164062
     w1: tensor([0.2719], requires_grad=True) w2: tensor([0.8831], requires_grad=True)
    grad: w1: 1.7295570373535156 w2: 0.5765190124511719
     w1: tensor([0.2546], requires_grad=True) w2: tensor([0.8773], requires_grad=True)
progress: 60 0.009232616052031517
    grad: w1: 0.26381874084472656 w2: 0.26381874084472656
     w1: tensor([0.2519], requires_grad=True) w2: tensor([0.8747], requires_grad=True)
    grad: w1: -1.9430084228515625 w2: -0.9715042114257812
     w1: tensor([0.2714], requires_grad=True) w2: tensor([0.8844], requires_grad=True)
    grad: w1: 1.7187938690185547 w2: 0.5729312896728516
     w1: tensor([0.2542], requires_grad=True) w2: tensor([0.8787], requires_grad=True)
progress: 61 0.009118062444031239
    grad: w1: 0.26572132110595703 w2: 0.26572132110595703
     w1: tensor([0.2515], requires_grad=True) w2: tensor([0.8760], requires_grad=True)
    grad: w1: -1.9350357055664062 w2: -0.9675178527832031
     w1: tensor([0.2709], requires_grad=True) w2: tensor([0.8857], requires_grad=True)
    grad: w1: 1.7082195281982422 w2: 0.5694065093994141
     w1: tensor([0.2538], requires_grad=True) w2: tensor([0.8800], requires_grad=True)
progress: 62 0.009006216190755367
    grad: w1: 0.2675914764404297 w2: 0.2675914764404297
     w1: tensor([0.2511], requires_grad=True) w2: tensor([0.8773], requires_grad=True)
    grad: w1: -1.9272003173828125 w2: -0.9636001586914062
     w1: tensor([0.2704], requires_grad=True) w2: tensor([0.8870], requires_grad=True)
    grad: w1: 1.6978340148925781 w2: 0.5659446716308594
     w1: tensor([0.2534], requires_grad=True) w2: tensor([0.8813], requires_grad=True)
progress: 63 0.00889703817665577
    grad: w1: 0.2694282531738281 w2: 0.2694282531738281
     w1: tensor([0.2507], requires_grad=True) w2: tensor([0.8786], requires_grad=True)
    grad: w1: -1.9195060729980469 w2: -0.9597530364990234
     w1: tensor([0.2699], requires_grad=True) w2: tensor([0.8882], requires_grad=True)
    grad: w1: 1.6876373291015625 w2: 0.5625457763671875
     w1: tensor([0.2530], requires_grad=True) w2: tensor([0.8826], requires_grad=True)
progress: 64 0.00879049301147461
    grad: w1: 0.27123212814331055 w2: 0.27123212814331055
     w1: tensor([0.2503], requires_grad=True) w2: tensor([0.8799], requires_grad=True)
    grad: w1: -1.9119453430175781 w2: -0.9559726715087891
     w1: tensor([0.2694], requires_grad=True) w2: tensor([0.8894], requires_grad=True)
    grad: w1: 1.6776037216186523 w2: 0.5592012405395508
     w1: tensor([0.2527], requires_grad=True) w2: tensor([0.8838], requires_grad=True)
progress: 65 0.008686278946697712
    grad: w1: 0.27300548553466797 w2: 0.27300548553466797
     w1: tensor([0.2499], requires_grad=True) w2: tensor([0.8811], requires_grad=True)
    grad: w1: -1.9045143127441406 w2: -0.9522571563720703
     w1: tensor([0.2690], requires_grad=True) w2: tensor([0.8906], requires_grad=True)
    grad: w1: 1.6677589416503906 w2: 0.5559196472167969
     w1: tensor([0.2523], requires_grad=True) w2: tensor([0.8851], requires_grad=True)
progress: 66 0.008584629744291306
    grad: w1: 0.2747468948364258 w2: 0.2747468948364258
     w1: tensor([0.2495], requires_grad=True) w2: tensor([0.8823], requires_grad=True)
    grad: w1: -1.8972187042236328 w2: -0.9486093521118164
     w1: tensor([0.2685], requires_grad=True) w2: tensor([0.8918], requires_grad=True)
    grad: w1: 1.6580772399902344 w2: 0.5526924133300781
     w1: tensor([0.2519], requires_grad=True) w2: tensor([0.8863], requires_grad=True)
progress: 67 0.008485247381031513
    grad: w1: 0.2764582633972168 w2: 0.2764582633972168
     w1: tensor([0.2492], requires_grad=True) w2: tensor([0.8835], requires_grad=True)
    grad: w1: -1.890045166015625 w2: -0.9450225830078125
     w1: tensor([0.2681], requires_grad=True) w2: tensor([0.8930], requires_grad=True)
    grad: w1: 1.648575782775879 w2: 0.549525260925293
     w1: tensor([0.2516], requires_grad=True) w2: tensor([0.8875], requires_grad=True)
progress: 68 0.00838827807456255
    grad: w1: 0.2781391143798828 w2: 0.2781391143798828
     w1: tensor([0.2488], requires_grad=True) w2: tensor([0.8847], requires_grad=True)
    grad: w1: -1.8830032348632812 w2: -0.9415016174316406
     w1: tensor([0.2676], requires_grad=True) w2: tensor([0.8941], requires_grad=True)
    grad: w1: 1.639237403869629 w2: 0.546412467956543
     w1: tensor([0.2512], requires_grad=True) w2: tensor([0.8887], requires_grad=True)
progress: 69 0.008293516002595425
    grad: w1: 0.27979087829589844 w2: 0.27979087829589844
     w1: tensor([0.2484], requires_grad=True) w2: tensor([0.8859], requires_grad=True)
    grad: w1: -1.8760833740234375 w2: -0.9380416870117188
     w1: tensor([0.2672], requires_grad=True) w2: tensor([0.8952], requires_grad=True)
    grad: w1: 1.6300621032714844 w2: 0.5433540344238281
     w1: tensor([0.2509], requires_grad=True) w2: tensor([0.8898], requires_grad=True)
progress: 70 0.0082009332254529
    grad: w1: 0.28141307830810547 w2: 0.28141307830810547
     w1: tensor([0.2481], requires_grad=True) w2: tensor([0.8870], requires_grad=True)
    grad: w1: -1.8692855834960938 w2: -0.9346427917480469
     w1: tensor([0.2668], requires_grad=True) w2: tensor([0.8963], requires_grad=True)
    grad: w1: 1.6210498809814453 w2: 0.5403499603271484
     w1: tensor([0.2506], requires_grad=True) w2: tensor([0.8909], requires_grad=True)
progress: 71 0.008110501803457737
    grad: w1: 0.2830071449279785 w2: 0.2830071449279785
     w1: tensor([0.2477], requires_grad=True) w2: tensor([0.8881], requires_grad=True)
    grad: w1: -1.8626060485839844 w2: -0.9313030242919922
     w1: tensor([0.2664], requires_grad=True) w2: tensor([0.8974], requires_grad=True)
    grad: w1: 1.6121835708618164 w2: 0.5373945236206055
     w1: tensor([0.2502], requires_grad=True) w2: tensor([0.8920], requires_grad=True)
progress: 72 0.008022024296224117
    grad: w1: 0.2845735549926758 w2: 0.2845735549926758
     w1: tensor([0.2474], requires_grad=True) w2: tensor([0.8892], requires_grad=True)
    grad: w1: -1.8560409545898438 w2: -0.9280204772949219
     w1: tensor([0.2660], requires_grad=True) w2: tensor([0.8985], requires_grad=True)
    grad: w1: 1.6034889221191406 w2: 0.5344963073730469
     w1: tensor([0.2499], requires_grad=True) w2: tensor([0.8931], requires_grad=True)
progress: 73 0.007935730740427971
    grad: w1: 0.28611183166503906 w2: 0.28611183166503906
     w1: tensor([0.2471], requires_grad=True) w2: tensor([0.8903], requires_grad=True)
    grad: w1: -1.8495960235595703 w2: -0.9247980117797852
     w1: tensor([0.2656], requires_grad=True) w2: tensor([0.8995], requires_grad=True)
    grad: w1: 1.594940185546875 w2: 0.531646728515625
     w1: tensor([0.2496], requires_grad=True) w2: tensor([0.8942], requires_grad=True)
progress: 74 0.007851339876651764
    grad: w1: 0.28762340545654297 w2: 0.28762340545654297
     w1: tensor([0.2467], requires_grad=True) w2: tensor([0.8913], requires_grad=True)
    grad: w1: -1.84326171875 w2: -0.921630859375
     w1: tensor([0.2652], requires_grad=True) w2: tensor([0.9005], requires_grad=True)
    grad: w1: 1.5865459442138672 w2: 0.5288486480712891
     w1: tensor([0.2493], requires_grad=True) w2: tensor([0.8953], requires_grad=True)
progress: 75 0.007768913637846708
    grad: w1: 0.2891082763671875 w2: 0.2891082763671875
     w1: tensor([0.2464], requires_grad=True) w2: tensor([0.8924], requires_grad=True)
    grad: w1: -1.8370399475097656 w2: -0.9185199737548828
     w1: tensor([0.2648], requires_grad=True) w2: tensor([0.9015], requires_grad=True)
    grad: w1: 1.5782890319824219 w2: 0.5260963439941406
     w1: tensor([0.2490], requires_grad=True) w2: tensor([0.8963], requires_grad=True)
progress: 76 0.007688260171562433
    grad: w1: 0.29056787490844727 w2: 0.29056787490844727
     w1: tensor([0.2461], requires_grad=True) w2: tensor([0.8934], requires_grad=True)
    grad: w1: -1.830923080444336 w2: -0.915461540222168
     w1: tensor([0.2644], requires_grad=True) w2: tensor([0.9025], requires_grad=True)
    grad: w1: 1.5701866149902344 w2: 0.5233955383300781
     w1: tensor([0.2487], requires_grad=True) w2: tensor([0.8973], requires_grad=True)
progress: 77 0.007609524764120579
    grad: w1: 0.29200124740600586 w2: 0.29200124740600586
     w1: tensor([0.2458], requires_grad=True) w2: tensor([0.8944], requires_grad=True)
    grad: w1: -1.8249187469482422 w2: -0.9124593734741211
     w1: tensor([0.2640], requires_grad=True) w2: tensor([0.9035], requires_grad=True)
    grad: w1: 1.562230110168457 w2: 0.5207433700561523
     w1: tensor([0.2484], requires_grad=True) w2: tensor([0.8983], requires_grad=True)
progress: 78 0.007532601710408926
    grad: w1: 0.2934093475341797 w2: 0.2934093475341797
     w1: tensor([0.2455], requires_grad=True) w2: tensor([0.8954], requires_grad=True)
    grad: w1: -1.8190193176269531 w2: -0.9095096588134766
     w1: tensor([0.2637], requires_grad=True) w2: tensor([0.9045], requires_grad=True)
    grad: w1: 1.5543937683105469 w2: 0.5181312561035156
     w1: tensor([0.2481], requires_grad=True) w2: tensor([0.8993], requires_grad=True)
progress: 79 0.007457222323864698
    grad: w1: 0.29479312896728516 w2: 0.29479312896728516
     w1: tensor([0.2452], requires_grad=True) w2: tensor([0.8963], requires_grad=True)
    grad: w1: -1.8132209777832031 w2: -0.9066104888916016
     w1: tensor([0.2633], requires_grad=True) w2: tensor([0.9054], requires_grad=True)
    grad: w1: 1.5467205047607422 w2: 0.5155735015869141
     w1: tensor([0.2478], requires_grad=True) w2: tensor([0.9002], requires_grad=True)
progress: 80 0.007383778691291809
    grad: w1: 0.29615211486816406 w2: 0.29615211486816406
     w1: tensor([0.2449], requires_grad=True) w2: tensor([0.8973], requires_grad=True)
    grad: w1: -1.8075275421142578 w2: -0.9037637710571289
     w1: tensor([0.2630], requires_grad=True) w2: tensor([0.9063], requires_grad=True)
    grad: w1: 1.539158821105957 w2: 0.5130529403686523
     w1: tensor([0.2476], requires_grad=True) w2: tensor([0.9012], requires_grad=True)
progress: 81 0.007311759050935507
    grad: w1: 0.2974872589111328 w2: 0.2974872589111328
     w1: tensor([0.2446], requires_grad=True) w2: tensor([0.8982], requires_grad=True)
    grad: w1: -1.8019294738769531 w2: -0.9009647369384766
     w1: tensor([0.2626], requires_grad=True) w2: tensor([0.9072], requires_grad=True)
    grad: w1: 1.5317516326904297 w2: 0.5105838775634766
     w1: tensor([0.2473], requires_grad=True) w2: tensor([0.9021], requires_grad=True)
progress: 82 0.007241552695631981
    grad: w1: 0.2987990379333496 w2: 0.2987990379333496
     w1: tensor([0.2443], requires_grad=True) w2: tensor([0.8991], requires_grad=True)
    grad: w1: -1.7964363098144531 w2: -0.8982181549072266
     w1: tensor([0.2623], requires_grad=True) w2: tensor([0.9081], requires_grad=True)
    grad: w1: 1.5244560241699219 w2: 0.5081520080566406
     w1: tensor([0.2470], requires_grad=True) w2: tensor([0.9030], requires_grad=True)
progress: 83 0.007172734942287207
    grad: w1: 0.30008792877197266 w2: 0.30008792877197266
     w1: tensor([0.2440], requires_grad=True) w2: tensor([0.9000], requires_grad=True)
    grad: w1: -1.7910327911376953 w2: -0.8955163955688477
     w1: tensor([0.2619], requires_grad=True) w2: tensor([0.9090], requires_grad=True)
    grad: w1: 1.5172977447509766 w2: 0.5057659149169922
     w1: tensor([0.2468], requires_grad=True) w2: tensor([0.9039], requires_grad=True)
progress: 84 0.007105532102286816
    grad: w1: 0.30135440826416016 w2: 0.30135440826416016
     w1: tensor([0.2437], requires_grad=True) w2: tensor([0.9009], requires_grad=True)
    grad: w1: -1.7857284545898438 w2: -0.8928642272949219
     w1: tensor([0.2616], requires_grad=True) w2: tensor([0.9098], requires_grad=True)
    grad: w1: 1.5102596282958984 w2: 0.5034198760986328
     w1: tensor([0.2465], requires_grad=True) w2: tensor([0.9048], requires_grad=True)
progress: 85 0.007039765827357769
    grad: w1: 0.3025979995727539 w2: 0.3025979995727539
     w1: tensor([0.2435], requires_grad=True) w2: tensor([0.9018], requires_grad=True)
    grad: w1: -1.7805137634277344 w2: -0.8902568817138672
     w1: tensor([0.2613], requires_grad=True) w2: tensor([0.9107], requires_grad=True)
    grad: w1: 1.5033416748046875 w2: 0.5011138916015625
     w1: tensor([0.2462], requires_grad=True) w2: tensor([0.9057], requires_grad=True)
progress: 86 0.006975420285016298
    grad: w1: 0.3038206100463867 w2: 0.3038206100463867
     w1: tensor([0.2432], requires_grad=True) w2: tensor([0.9026], requires_grad=True)
    grad: w1: -1.7753925323486328 w2: -0.8876962661743164
     w1: tensor([0.2610], requires_grad=True) w2: tensor([0.9115], requires_grad=True)
    grad: w1: 1.4965696334838867 w2: 0.4988565444946289
     w1: tensor([0.2460], requires_grad=True) w2: tensor([0.9065], requires_grad=True)
progress: 87 0.006912718061357737
    grad: w1: 0.3050212860107422 w2: 0.3050212860107422
     w1: tensor([0.2429], requires_grad=True) w2: tensor([0.9035], requires_grad=True)
    grad: w1: -1.770364761352539 w2: -0.8851823806762695
     w1: tensor([0.2606], requires_grad=True) w2: tensor([0.9123], requires_grad=True)
    grad: w1: 1.4898834228515625 w2: 0.4966278076171875
     w1: tensor([0.2457], requires_grad=True) w2: tensor([0.9074], requires_grad=True)
progress: 88 0.006851088255643845
    grad: w1: 0.3062009811401367 w2: 0.3062009811401367
     w1: tensor([0.2427], requires_grad=True) w2: tensor([0.9043], requires_grad=True)
    grad: w1: -1.7654190063476562 w2: -0.8827095031738281
     w1: tensor([0.2603], requires_grad=True) w2: tensor([0.9131], requires_grad=True)
    grad: w1: 1.4833431243896484 w2: 0.4944477081298828
     w1: tensor([0.2455], requires_grad=True) w2: tensor([0.9082], requires_grad=True)
progress: 89 0.006791070569306612
    grad: w1: 0.3073596954345703 w2: 0.3073596954345703
     w1: tensor([0.2424], requires_grad=True) w2: tensor([0.9051], requires_grad=True)
    grad: w1: -1.7605648040771484 w2: -0.8802824020385742
     w1: tensor([0.2600], requires_grad=True) w2: tensor([0.9139], requires_grad=True)
    grad: w1: 1.476888656616211 w2: 0.4922962188720703
     w1: tensor([0.2453], requires_grad=True) w2: tensor([0.9090], requires_grad=True)
progress: 90 0.00673209922388196
    grad: w1: 0.3084983825683594 w2: 0.3084983825683594
     w1: tensor([0.2422], requires_grad=True) w2: tensor([0.9059], requires_grad=True)
    grad: w1: -1.7557907104492188 w2: -0.8778953552246094
     w1: tensor([0.2597], requires_grad=True) w2: tensor([0.9147], requires_grad=True)
    grad: w1: 1.4705801010131836 w2: 0.49019336700439453
     w1: tensor([0.2450], requires_grad=True) w2: tensor([0.9098], requires_grad=True)
progress: 91 0.006674709264189005
    grad: w1: 0.3096165657043457 w2: 0.3096165657043457
     w1: tensor([0.2419], requires_grad=True) w2: tensor([0.9067], requires_grad=True)
    grad: w1: -1.7511062622070312 w2: -0.8755531311035156
     w1: tensor([0.2595], requires_grad=True) w2: tensor([0.9154], requires_grad=True)
    grad: w1: 1.4643573760986328 w2: 0.48811912536621094
     w1: tensor([0.2448], requires_grad=True) w2: tensor([0.9106], requires_grad=True)
progress: 92 0.006618340965360403
    grad: w1: 0.3107156753540039 w2: 0.3107156753540039
     w1: tensor([0.2417], requires_grad=True) w2: tensor([0.9074], requires_grad=True)
    grad: w1: -1.7465019226074219 w2: -0.8732509613037109
     w1: tensor([0.2592], requires_grad=True) w2: tensor([0.9162], requires_grad=True)
    grad: w1: 1.4582548141479492 w2: 0.4860849380493164
     w1: tensor([0.2446], requires_grad=True) w2: tensor([0.9113], requires_grad=True)
progress: 93 0.006563293747603893
    grad: w1: 0.3117952346801758 w2: 0.3117952346801758
     w1: tensor([0.2415], requires_grad=True) w2: tensor([0.9082], requires_grad=True)
    grad: w1: -1.7419776916503906 w2: -0.8709888458251953
     w1: tensor([0.2589], requires_grad=True) w2: tensor([0.9169], requires_grad=True)
    grad: w1: 1.4522552490234375 w2: 0.4840850830078125
     w1: tensor([0.2444], requires_grad=True) w2: tensor([0.9121], requires_grad=True)
progress: 94 0.00650939904153347
    grad: w1: 0.31285572052001953 w2: 0.31285572052001953
     w1: tensor([0.2412], requires_grad=True) w2: tensor([0.9089], requires_grad=True)
    grad: w1: -1.7375335693359375 w2: -0.8687667846679688
     w1: tensor([0.2586], requires_grad=True) w2: tensor([0.9176], requires_grad=True)
    grad: w1: 1.4463672637939453 w2: 0.48212242126464844
     w1: tensor([0.2441], requires_grad=True) w2: tensor([0.9128], requires_grad=True)
progress: 95 0.006456722971051931
    grad: w1: 0.31389808654785156 w2: 0.31389808654785156
     w1: tensor([0.2410], requires_grad=True) w2: tensor([0.9097], requires_grad=True)
    grad: w1: -1.7331657409667969 w2: -0.8665828704833984
     w1: tensor([0.2583], requires_grad=True) w2: tensor([0.9183], requires_grad=True)
    grad: w1: 1.4405736923217773 w2: 0.4801912307739258
     w1: tensor([0.2439], requires_grad=True) w2: tensor([0.9135], requires_grad=True)
progress: 96 0.00640510069206357
    grad: w1: 0.31492137908935547 w2: 0.31492137908935547
     w1: tensor([0.2408], requires_grad=True) w2: tensor([0.9104], requires_grad=True)
    grad: w1: -1.7288780212402344 w2: -0.8644390106201172
     w1: tensor([0.2581], requires_grad=True) w2: tensor([0.9190], requires_grad=True)
    grad: w1: 1.4348831176757812 w2: 0.47829437255859375
     w1: tensor([0.2437], requires_grad=True) w2: tensor([0.9142], requires_grad=True)
progress: 97 0.006354597397148609
    grad: w1: 0.31592750549316406 w2: 0.31592750549316406
     w1: tensor([0.2406], requires_grad=True) w2: tensor([0.9111], requires_grad=True)
    grad: w1: -1.724660873413086 w2: -0.862330436706543
     w1: tensor([0.2578], requires_grad=True) w2: tensor([0.9197], requires_grad=True)
    grad: w1: 1.4293041229248047 w2: 0.47643470764160156
     w1: tensor([0.2435], requires_grad=True) w2: tensor([0.9149], requires_grad=True)
progress: 98 0.006305278744548559
    grad: w1: 0.31691551208496094 w2: 0.31691551208496094
     w1: tensor([0.2403], requires_grad=True) w2: tensor([0.9118], requires_grad=True)
    grad: w1: -1.7205219268798828 w2: -0.8602609634399414
     w1: tensor([0.2576], requires_grad=True) w2: tensor([0.9204], requires_grad=True)
    grad: w1: 1.4238109588623047 w2: 0.47460365295410156
     w1: tensor([0.2433], requires_grad=True) w2: tensor([0.9156], requires_grad=True)
progress: 99 0.0062569063156843185
Predict(after training) 4 8.55555248260498

Process finished with exit code 0
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值