Advertisement
Guest User

Untitled

a guest
Apr 20th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.09 KB | None | 0 0
  1. import numpy as np
  2.  
  3. w0 = np.array([[0.27921417355537415, -0.14108330011367798, -0.29153314232826233, 0.4013959765434265, -0.21942253410816193, -0.35232996940612793, 0.35006576776504517, 0.2981374263763428, -0.004578662104904652, -0.380142480134964, -0.22100479900836945, -0.16006147861480713, 0.17119120061397552, 0.0024457972031086683, 0.4444245994091034, 0.19310501217842102, -0.3514907658100128, -0.027401983737945557, 0.4293577969074249, -0.10713183879852295, 0.16130664944648743, 0.41452571749687195, 0.14857640862464905, -0.37896695733070374, -0.0839529037475586, 0.09879623353481293, -0.290716290473938, -0.1780383586883545, 0.012463293969631195, -0.1790006011724472, -0.16526535153388977, 0.23618613183498383]])
  4. b0 = np.array([0.3431054353713989, 0.0, 0.0, 0.35239338874816895, 0.0, 0.0, 0.16946491599082947, -0.14558488130569458, -0.02905430644750595, 0.0, 0.0, 0.0, 0.5308032631874084, -0.06088840216398239, 0.4312475919723511, -0.12934577465057373, 0.0, 0.0, 0.41426390409469604, 0.0, -0.11231445521116257, 0.3477647006511688, 0.44472411274909973, 0.0, 0.0, 0.4779088497161865, 0.0, 0.0, -0.0714155063033104, 0.0, 0.0, 0.36602088809013367])
  5. w1 = np.array([[0.482657790184021, 0.10032027959823608, -0.025870306417346, -0.3813351094722748, 0.11800839751958847, -0.09867917001247406, 0.37542837858200073, 0.18991082906723022], [-0.04444041848182678, 0.143654465675354, -0.1618870049715042, -0.25318092107772827, -0.13206210732460022, 0.32945704460144043, -0.06687697768211365, 0.03710260987281799], [0.10485467314720154, 0.3004154562950134, -0.3466840088367462, 0.13500821590423584, -0.06201660633087158, -0.1443701833486557, -0.06719082593917847, 0.17385101318359375], [0.45458081364631653, -0.27204352617263794, -0.2864987850189209, 0.2922554016113281, -0.09670335799455643, 0.26162633299827576, 0.38158541917800903, -0.331845760345459], [0.3176894187927246, 0.2339436411857605, 0.07572868466377258, -0.23303577303886414, 0.10518321394920349, 0.062449514865875244, -0.050564348697662354, 0.2395147681236267], [-0.2675657272338867, -0.17978565394878387, 0.38051170110702515, 0.17849880456924438, -0.06905904412269592, 0.0014664232730865479, 0.03800761699676514, 0.12832772731781006], [0.331623375415802, 0.047062307596206665, -0.20532861351966858, -0.10200738906860352, -0.050973039120435715, -0.23776467144489288, -0.08109664916992188, 0.1219109296798706], [0.2676903009414673, 0.20350664854049683, 0.10750088095664978, 0.006855137646198273, -0.2474856674671173, 0.20896324515342712, -0.2484407126903534, -0.008250594139099121], [-0.2294663041830063, 0.25239700078964233, -0.18325935304164886, -0.11275070160627365, -0.24416300654411316, 0.21640072762966156, -0.06989295780658722, 0.3353039622306824], [-0.2553171217441559, -0.15815189480781555, 0.35837358236312866, -0.32034066319465637, -0.06854590773582458, 0.05693945288658142, 0.36728984117507935, 0.37763017416000366], [0.2826741337776184, 0.3727511763572693, -0.09863710403442383, 0.3824157118797302, -0.02647373080253601, 0.0037828683853149414, -0.3715519309043884, 0.12411236763000488], [-0.2051236927509308, 0.3161178231239319, -0.23547214269638062, -0.31051838397979736, 0.25223666429519653, -0.18888558447360992, 0.19035589694976807, -0.10294482111930847], [0.4763239622116089, 0.03394302725791931, -0.3240586221218109, 0.09563875943422318, 0.25054931640625, 0.5088765621185303, 0.0828716978430748, -0.28559190034866333], [0.35434943437576294, -0.210627943277359, -0.2208661288022995, -0.16534461081027985, -0.26472803950309753, 0.4008157253265381, -0.2573435306549072, -0.1106904149055481], [0.2019670456647873, -0.08988282084465027, 0.04172448441386223, -0.1789180189371109, 0.29186633229255676, 0.3205849528312683, 0.17554236948490143, 0.3308296203613281], [0.007065621204674244, 0.23973476886749268, -0.2561907470226288, -0.04758049175143242, -0.12678541243076324, -0.01690165139734745, -0.27455875277519226, -0.11088478565216064], [0.37364691495895386, 0.37966835498809814, 0.23386812210083008, 0.20452940464019775, 0.017791718244552612, 0.27753520011901855, -0.36762744188308716, -0.3031083345413208], [0.07751721143722534, -0.3603648841381073, -0.10922738909721375, -0.14680378139019012, 0.380199670791626, 0.14808869361877441, -0.26269593834877014, 0.2696725130081177], [0.28005409240722656, 0.10559865832328796, -0.05295072868466377, 0.3240222930908203, 0.4423471689224243, 0.1675700843334198, 0.20572209358215332, 0.14889609813690186], [-0.20553210377693176, -0.14938050508499146, 0.34612375497817993, 0.19423413276672363, 0.3182992935180664, -0.05121311545372009, -0.16090360283851624, -0.15435943007469177], [-0.34910574555397034, -0.19043928384780884, -0.22666624188423157, -0.02579418569803238, -0.17247247695922852, -0.2178809493780136, -0.3322761356830597, -0.2411748319864273], [0.4759419560432434, 0.08754357695579529, 0.3384535610675812, -0.1238795593380928, 0.04633718356490135, 0.2806067168712616, 0.44351816177368164, -0.09031543135643005], [0.5359269380569458, -0.11257192492485046, -0.07674799114465714, -0.04103003069758415, 0.047590017318725586, 0.4055318832397461, 0.20758827030658722, -0.29444748163223267], [0.007997304201126099, 0.26380473375320435, 0.0062181055545806885, -0.16418348252773285, -0.12378880381584167, 0.1328379511833191, 0.3526573181152344, -0.08692112565040588], [0.21280354261398315, 0.06367069482803345, -0.3436475098133087, 0.37806159257888794, 0.37934672832489014, -0.019976288080215454, 0.1605646014213562, -0.1225174069404602], [0.5045793652534485, -0.3454762101173401, 0.21508702635765076, -0.26160794496536255, -0.029233651235699654, 0.5675521492958069, 0.17253731191158295, -0.06750258803367615], [0.22231686115264893, 0.37585335969924927, 0.2876843810081482, 0.37610363960266113, 0.29447323083877563, 0.06397929787635803, 0.130632221698761, -0.029248863458633423], [0.36363309621810913, -0.0910688042640686, -0.37640833854675293, -0.11533552408218384, 0.3223204016685486, -0.12097883224487305, -0.16963517665863037, 0.23236244916915894], [0.04483663663268089, 0.29983121156692505, -0.1284712553024292, 0.2568896412849426, -0.25933578610420227, 0.2401135414838791, -0.2667403519153595, -0.17305634915828705], [0.2852267622947693, 0.2226657271385193, 0.08599799871444702, -0.13036170601844788, 0.3235376477241516, -0.298784077167511, 0.29119980335235596, 0.37554025650024414], [0.05294060707092285, 0.13081645965576172, -0.30001866817474365, -0.04568469524383545, -0.011763453483581543, 0.23429328203201294, 0.002440154552459717, -0.18129365146160126], [0.3904288113117218, -0.2511572241783142, 0.287677139043808, 0.09779088199138641, 0.15749244391918182, 0.21710316836833954, 0.48223572969436646, -0.24755121767520905]])
  6. b1 = np.array([0.3207662105560303, 0.0, -0.019432447850704193, -0.012111270800232887, 0.41701453924179077, 0.5328116416931152, 0.29369330406188965, 0.0])
  7. w2 = np.array([[0.34143516421318054], [0.4061342477798462], [-0.08923159539699554], [-0.5081609487533569], [0.45943304896354675], [0.1573014259338379], [0.8774638175964355], [0.03378307819366455]])
  8. b2 = np.array([0.26909077167510986])
  9.  
  10. def relu(x):
  11.   return np.maximum(0, x)
  12.  
  13. def predict(x):
  14.   l0 = np.dot(x, w0) + b0
  15.   l0 = relu(l0)
  16.   l1 = np.dot(l0, w1) + b1
  17.   l1 = relu(l1)
  18.   l2 = np.dot(l1, w2) + b2
  19.   return l2
  20.  
  21. print(predict([[1.25]]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement