Skip to content

Commit

Permalink
add functions that read network from .txt files.
Browse files Browse the repository at this point in the history
  • Loading branch information
xingdi-eric-yuan committed Aug 11, 2015
1 parent 2087e68 commit 25ef60e
Show file tree
Hide file tree
Showing 25 changed files with 618 additions and 250 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -6,6 +6,7 @@ Deep neural network framework (C/C++/CUDA).
To run this code, you should have
* a cifar-10 dataset( put "cifar-10-batches-bin" where this .md file is, you can get it from [HERE](http://www.cs.toronto.edu/~kriz/cifar.html), make sure to download the binary version which suitable for C programs);
* nVidia graphic card which supports nVidia CUDA
* for running network with pre-trained network, you should put pre-trained files into "config" folder, there is a demo config folder which is named "pre-trained-conf", you can rename it to "config" and replace the current "config" folder.

##Compile & Run
add this project into nVidia nsight, add **curand** and **cufft** into path.
Expand All @@ -14,6 +15,7 @@ add this project into nVidia nsight, add **curand** and **cufft** into path.
* 0.1.0: Aug.5, the first version released.
* 0.1.1: Aug.10, remove hostData in Mat, only use device memory, for speed up.
* 0.1.1: Aug.11, add functions that save matrices and configs into .txt files.
* 0.1.1: Aug.12, add functions that read network from .txt files.

##Data Structures
####Mat
Expand Down
2 changes: 1 addition & 1 deletion config.txt → config/config.txt
Expand Up @@ -9,7 +9,7 @@
*******************************************************/

IS_GRADIENT_CHECKING = false;
USE_LOG = false;
USE_LOG = true;
LEARNING_RATE_W = 1e-3;
LEARNING_RATE_B = 3e-4;
TRAINING_EPOCHS = 500;
Expand Down
3 changes: 3 additions & 0 deletions pre-trained-conf/layer_1_kernel_0_b.txt
@@ -0,0 +1,3 @@
path = saved_data/iter_101/layer_1_kernel_0_b.txt
data =
-0.008138897828757763 -0.00717396242544055 0.0003210979630239308
6 changes: 6 additions & 0 deletions pre-trained-conf/layer_1_kernel_0_w.txt
@@ -0,0 +1,6 @@
path = saved_data/iter_101/layer_1_kernel_0_w.txt
rows = 15
cols = 15
channels = 3
data =
-0.1557579934597015 0.05858244001865387 -0.1601570099592209 -0.04685496911406517 0.1283472925424576 0.1303123086690903 -0.07633047550916672 -0.07198808342218399 0.08376554399728775 0.1241729483008385 0.1283252388238907 -0.02141774818301201 -0.008913194760680199 0.0006498729344457388 -0.07684206962585449 0.03102790378034115 -0.07509538531303406 -0.118589349091053 0.1056273505091667 -0.1433991193771362 -0.2333247512578964 -0.146151065826416 -0.1617075502872467 -0.1021017655730247 0.0813731849193573 -0.08773058652877808 -0.05685989558696747 -0.2328771203756332 0.0138669116422534 -0.07702718675136566 -0.1576106548309326 -0.170792430639267 -0.05503313615918159 -0.09065182507038116 0.05069182440638542 0.208939716219902 0.02901214174926281 0.1291956305503845 -0.1584814786911011 -0.01992079801857471 -0.04653000086545944 -0.003568163141608238 -0.2385715842247009 0.06582789123058319 0.1659221649169922 -0.160754382610321 0.05681968107819557 -0.1816937774419785 -0.0003160010965075344 0.2217285931110382 0.01917242631316185 0.01094665285199881 0.07905594259500504 0.1371871829032898 0.06044628843665123 -0.1473841518163681 -0.04834957420825958 -0.09239985793828964 -0.1192216426134109 -0.1203390583395958 -0.02631377056241035 -0.06013885512948036 0.008416193537414074 0.03359567001461983 -0.06441760063171387 -0.07758450508117676 -0.121717281639576 -0.1437357664108276 -0.05809665843844414 -0.1731510013341904 0.1020210981369019 0.08190836757421494 -0.04906803742051125 -0.216856375336647 -0.02201595157384872 -0.05382832139730453 -0.07275846600532532 0.04273556545376778 0.1031829118728638 -0.2408643066883087 -0.03117980062961578 -0.2215147018432617 0.008339842781424522 0.01840970851480961 0.1558681726455688 0.04554020613431931 0.2316680997610092 -0.05311849340796471 -0.01844194903969765 -0.004877535626292229 0.05438933521509171 -0.01137155294418335 -0.01204056572169065 -0.06559737771749496 -0.2455612868070602 0.07637865841388702 -0.1073855385184288 0.08050133287906647 0.05381197109818459 -0.0222397968173027 0.1989519596099854 0.0808149054646492 0.02571967616677284 -0.07577697932720184 0.1198443025350571 0.1536533087491989 0.09484619647264481 0.1333723366260529 0.117839440703392 -0.06012930348515511 -0.1000023633241653 0.06119861081242561 0.06062141805887222 -0.3402078449726105 -0.07243936508893967 -0.04627731814980507 0.04572312533855438 0.1288193166255951 0.03785370290279388 -0.06368247419595718 -0.05955851078033447 -0.03923524543642998 -0.1610352694988251 -0.05427359044551849 -0.05122055858373642 0.2551673650741577 0.0139620928093791 0.02486058697104454 -0.04054863378405571 -0.02192765660583973 0.2009013891220093 -0.02684800326824188 0.250765860080719 0.0291590504348278 0.04652436822652817 -0.09654539078474045 -0.04843283444643021 0.02424842678010464 -0.1276150345802307 -0.07297328859567642 0.126676470041275 0.006973408628255129 -0.03218011930584908 0.1332663744688034 -0.01470493525266647 -0.1006293594837189 0.227857768535614 -0.22511987388134 0.003230428323149681 -0.2312864065170288 0.08257398754358292 -0.1557276248931885 0.02866364829242229 -0.03814179077744484 -0.001046651974320412 -0.03131160885095596 -0.1362889558076859 -0.1277386844158173 0.01368826813995838 -0.01156201865524054 -0.06007867678999901 0.07179379463195801 -0.02942012995481491 -0.03985680267214775 0.02710961364209652 -0.02052647806704044 0.06948073953390121 0.02619102969765663 0.1142005324363708 -0.07076449692249298 -0.01939004473388195 -0.08932599425315857 0.1401941627264023 0.08433616906404495 0.3040190935134888 0.1309132426977158 -0.1868404000997543 0.0407773032784462 0.03881334140896797 -0.01831026375293732 -0.111685149371624 0.2076689600944519 -0.1439798325300217 0.1047143191099167 0.1122442707419395 -0.05045996978878975 0.1397281289100647 0.1111199259757996 -0.2146873474121094 -0.01795476488769054 0.07332713156938553 -0.1081984415650368 -0.2794011235237122 -0.05081415176391602 -0.08810169249773026 0.06546779721975327 -0.008401990868151188 -0.06956259161233902 -0.08488579839468002 -0.07004968822002411 -0.01485719904303551 0.0175029095262289 0.0272029135376215 -0.04460844397544861 -0.2415712177753448 -0.1388692110776901 -0.005268797744065523 -0.2335190325975418 -0.03415244445204735 0.05244828388094902 -0.04795103147625923 -0.08988220989704132 0.1101316213607788 -0.2724233567714691 0.2352982312440872 0.06389433145523071 -0.09755301475524902 -0.1490789353847504 0.1414219290018082 -0.2756124436855316 -0.2883407771587372 -0.1166344359517097 -0.02702833153307438 0.05260392278432846 -0.01435074303299189 0.02893813140690327 -0.0187035221606493 0.007022167555987835 -0.1415499001741409 -0.2330614477396011 -0.1107687801122665 -0.06647341698408127 -0.1147146672010422 0.2282941341400146 -0.13007852435112 0.1294957846403122 0.1585252285003662 -0.01749783381819725 -0.06799527257680893 0.04581634700298309 0.1473807841539383 -0.1059810593724251 0.1777466833591461 -0.08084417134523392 -0.3447021245956421 -0.1779862195253372 -0.2172539830207825 0.06306473910808563 -0.06438589841127396 -0.007711600512266159 0.1958435028791428 0.01275655068457127 0.1006593406200409 0.05958176404237747 -0.1898022443056107 -0.03883586451411247 -0.06454397737979889 -0.2733370065689087 0.0977795347571373 -0.07325401157140732 0.1139014065265656 -0.009439266286790371 -0.0283323097974062 0.08208367973566055 -0.2676811218261719 -0.004682219121605158 -0.2364793419837952 0.1062732115387917 -0.01938233152031898 -0.1805986016988754 -0.01692380011081696 0.2423128932714462 0.0102910278365016 0.06609485298395157 0.232308492064476 0.04334915056824684 0.2465470284223557 0.1120632290840149 -0.1446668058633804 -0.09200819581747055 -0.04596816003322601 0.1097588017582893 0.03166214004158974 0.007856934331357479 -0.09619723260402679 -0.0977761372923851 0.09168996661901474 0.1729824393987656 0.02849740348756313 -0.02083222381770611 -0.1942465454339981 -0.14532370865345 0.1040752530097961 -0.2081439048051834 0.07118072360754013 0.157312735915184 0.02557714283466339 -0.008612001314759254 0.09385430812835693 -0.1168356612324715 0.07395406812429428 0.06170682609081268 0.0599324107170105 0.05015316605567932 0.07885456830263138 -0.01622729189693928 0.02298727817833424 0.0593283399939537 -0.07232247292995453 0.1073642671108246 0.1735107153654099 -0.2018450051546097 0.02760964259505272 0.07518983632326126 -0.09976937621831894 0.07720536738634109 -0.01888865046203136 0.03794574737548828 -0.08638100326061249 -0.08961676061153412 0.05014920607209206 -0.1684664040803909 0.07814984768629074 -0.1390509605407715 0.07904694974422455 -0.1187165677547455 0.1503603160381317 -0.1825011819601059 0.1549130082130432 0.0731654018163681 -0.0294753797352314 0.08320116251707077 -0.02410738915205002 -0.132792741060257 0.08101895451545715 -0.1463562101125717 -0.1524290293455124 0.2151027321815491 0.1215649768710136 0.05292768776416779 -0.09680250287055969 0.09819163382053375 -0.1555819064378738 -0.06507956981658936 0.06822212040424347 0.03513613343238831 -0.1078442856669426 0.1804779171943665 0.1196779161691666 -0.1143846437335014 -0.03287899866700172 0.02826889976859093 -0.03332600742578506 0.07603242993354797 -0.2140574306249619 -0.1563862860202789 0.01212990935891867 -0.0163030568510294 -0.08834132552146912 0.02390447445213795 0.01535278744995594 -0.05930924415588379 0.1058368980884552 -0.1515071988105774 -0.1791663765907288 -0.09818387031555176 -0.1600127816200256 -0.1166025027632713 0.4047544896602631 -0.05082464218139648 0.1029315665364265 -0.1242176368832588 0.07575303316116333 0.1239139959216118 -0.1229206994175911 -0.05949511751532555 -0.1780770123004913 -0.246185302734375 0.023228595033288 0.2411476373672485 -0.01579990796744823 -0.1304042637348175 -0.1592779755592346 0.03461045771837234 0.01094495505094528 0.1195320412516594 0.03517936170101166 -0.09776698797941208 0.01670419052243233 0.1012261956930161 0.08778140693902969 0.1333775222301483 -0.07564876973628998 -0.1902958005666733 -0.08341676741838455 -0.006888235453516245 0.004463000688701868 -0.009910689666867256 0.0806293711066246 -0.2218537032604218 -0.1352051347494125 -0.07613829523324966 0.009326901286840439 0.04838978126645088 0.1999730169773102 -0.1180538758635521 0.02032146789133549 -0.1128002554178238 0.1528242379426956 0.04069343954324722 0.04487646743655205 0.03911115229129791 -0.003349297912791371 0.06447640806436539 0.01944940350949764 0.04120238497853279 -0.116829551756382 -0.1189621537923813 0.02102281711995602 0.04014913737773895 -0.03301909938454628 0.1330280900001526 0.07622195035219193 -0.2005617767572403 -0.009356237947940826 -0.06340958923101425 0.03250346705317497 -0.1297099590301514 0.1199247166514397 0.1333077549934387 -0.1366564929485321 -0.1385022103786469 0.1427544355392456 0.05803301557898521 -0.001491133822128177 0.2778660953044891 -0.08277770131826401 -0.07001399993896484 -0.1695992946624756 -0.102197527885437 0.05193287506699562 -0.02974588051438332 0.01163090951740742 0.1699777990579605 0.06716198474168777 -0.1043826267123222 0.003957610111683607 0.03090941533446312 -0.03715760260820389 0.1336031407117844 -0.0879097506403923 0.3480722010135651 0.02621788345277309 -0.09796247631311417 0.03882431983947754 -0.1914175599813461 -0.1213713437318802 -0.1593784093856812 0.1306972354650497 0.01244089473038912 0.008119881153106689 -0.1425777226686478 0.0459647923707962 0.1040869951248169 0.08287271112203598 -0.0210209283977747 -0.119001030921936 -0.1063046753406525 0.1420615315437317 0.03351342305541039 -6.254233448999003e-05 0.07712794840335846 0.1796690225601196 -0.03657208010554314 -0.1295704692602158 -0.1246424615383148 -0.1640061289072037 0.01687438227236271 0.08051226288080215 0.02121460251510143 -0.1439881920814514 -0.1848674565553665 -0.07658188045024872 0.05039102211594582 -0.01053544599562883 -0.001517860451713204 0.03816347196698189 -0.1890972554683685 -0.06378187239170074 -0.026088897138834 -0.08266123384237289 -0.08894417434930801 -0.08664566278457642 -0.07676898688077927 -0.06791016459465027 0.1928262114524841 0.03703573346138 -0.03052753396332264 0.1332927346229553 -0.1790240854024887 -0.05946061760187149 0.05046520009636879 -0.09340620040893555 -0.1019571274518967 -0.24309903383255 -0.07407702505588531 -0.1321612447500229 0.05773530900478363 -0.06662976741790771 -0.00691132340580225 0.07298710197210312 0.002980263670906425 0.17964206635952 -0.1630391627550125 -0.1389269381761551 0.1042099818587303 0.1624135673046112 -0.003796565346419811 -0.178067073225975 0.08787412941455841 -0.3054767847061157 -0.1255342960357666 -0.3739173412322998 -0.03723488748073578 -0.07768816500902176 -0.03299695625901222 -0.05360390618443489 -0.111347958445549 -0.0139260720461607 0.08902725577354431 -0.09941744059324265 -0.008119065314531326 -0.1321805417537689 0.0003020385629497468 0.03917797654867172 0.1648328453302383 -0.2191955298185349 0.04002657532691956 0.02813884615898132 0.08464791625738144 0.1028773486614227 0.1334743946790695 -0.006678584963083267 0.02406887523829937 0.1747979521751404 0.2045456022024155 -0.07831462472677231 -0.01834654621779919 0.05810334160923958 -0.03958999365568161 -0.08118350058794022 0.03532413020730019 0.08459246903657913 -0.00207032123580575 -0.2886012196540833 -0.2200436741113663 -0.1226653605699539 0.1638871431350708 0.1132546961307526 0.04623841494321823 -0.1001316905021667 -0.1128864288330078 -0.02421244606375694 0.09167043119668961 -0.005975282751023769 0.05477207899093628 -0.2514142096042633 -0.2198006212711334 -0.04109995439648628 0.2587921321392059 -0.2122170627117157 -0.08789240568876266 -0.1721130907535553 -0.03971458226442337 0.1601304560899734 -0.1276520788669586 -0.1101674810051918 -0.1147809475660324 -0.1300978064537048 0.0812520757317543 0.1624665111303329 -0.05761782452464104 -0.1399739235639572 -0.01642719656229019 -0.1028760150074959 -0.2078443765640259 0.05051164329051971 -0.08592669665813446 -0.0006423415616154671 0.1138256713747978 0.02921536006033421 0.1031492576003075 0.1105487272143364 -0.1003562211990356 -0.05112095549702644 0.04172101989388466 -0.08895765244960785 -0.1414050459861755 -0.05923369154334068 -0.004346940666437149 0.07158074527978897 0.1051264256238937 0.02645024843513966 -0.1136238798499107 0.1674578636884689 0.0002005502465181053 -0.03943508863449097 -0.04941290989518166 0.1180679053068161 0.2817367911338806 -0.1124198734760284 -0.04686888307332993 0.0298821534961462 0.05548927187919617 -0.07368806749582291 0.02870895527303219 -0.1128333210945129 -0.1197932064533234 -0.1085453629493713 0.02793759293854237 0.00279028108343482 -0.192121759057045 0.01672261208295822 -0.01975221931934357 0.09094985574483871 -0.2775457203388214 0.08442298322916031 -0.04304070770740509 -0.177155077457428 -0.1109858304262161 0.05949167907238007 0.0606711320579052 0.05407683923840523 0.09792900830507278 -0.0761898010969162 0.1380574703216553 0.02357019297778606 -0.04707847535610199 0.3263647556304932 -0.2476558238267899 0.1377064436674118 0.03378309682011604 -0.08883814513683319 0.1282261162996292 -0.1536171585321426 0.02049907855689526 -0.1667968332767487 0.2287507802248001 -0.03405560180544853 -0.1633166372776031 -0.1911082714796066 -0.02361725643277168 0.0547422356903553 -0.2664772868156433 -0.0359356515109539 0.07598434388637543 -0.1233119443058968 0.09730564057826996 -0.3095104992389679 -0.1918139904737473 -0.008201217278838158 -0.1182368397712708 0.1823980957269669 -0.07054968178272247 -0.1332340389490128 -0.1121793761849403 -0.193564236164093 -0.1648612171411514 -0.02050736546516418 0.3166836202144623 -0.02734830416738987 -0.1093292757868767 -0.05464160442352295 0.003062384435907006 -0.142333909869194
3 changes: 3 additions & 0 deletions pre-trained-conf/layer_1_kernel_1_b.txt
@@ -0,0 +1,3 @@
path = saved_data/iter_101/layer_1_kernel_1_b.txt
data =
-0.006269176956266165 -0.01581663265824318 -0.001062156283296645

0 comments on commit 25ef60e

Please sign in to comment.