Last active
June 21, 2026 14:56
-
-
Save soumith/ce6b4164dd16f4bfce37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Torch Android demo script | |
| -- Script: main.lua | |
| -- Copyright (C) 2013 Soumith Chintala | |
| require 'torch' | |
| require 'cunn' | |
| require 'nnx' | |
| require 'dok' | |
| require 'image' | |
| function demoluafn() | |
| ret = 'Called demo function from inside lua' | |
| print() | |
| return ret | |
| end | |
| print("Hello from Lua") | |
| torch.setdefaulttensortype('torch.FloatTensor') | |
| -- Doing a small benchmark of the convolution module | |
| in_planes = 3 | |
| out_planes = 16 | |
| imsz_x = 640 | |
| imsz_y = 480 | |
| num_ops = 2 -- 2 ops, i.e one for multiply and one for accumulate | |
| test_tensor = torch.rand(in_planes,imsz_x,imsz_y):cuda() | |
| for kernel_sz=1,16 do | |
| local model = nn.SpatialConvolution(in_planes,out_planes,kernel_sz,kernel_sz):cuda() | |
| tstart = os.clock() | |
| output1 = model:forward(test_tensor) | |
| tend = os.clock() | |
| print('-------------------------------------------------------------------------------------------') | |
| print('Input Size: ' .. in_planes .. 'x' .. imsz_x .. 'x' .. imsz_y | |
| .. '\t\tKernel Size: ' .. kernel_sz .. 'x' .. kernel_sz .. '\t\tOutput Planes:' .. out_planes) | |
| print('Time taken (in seconds): ' .. (tend-tstart)) | |
| total_ops = in_planes*kernel_sz*kernel_sz*out_planes*(imsz_x-kernel_sz+1)*(imsz_y-kernel_sz+1)*num_ops | |
| print('GOps:' .. total_ops / 1e9) | |
| print('Gops/s: ' .. ( total_ops/( (tend-tstart) * 1e9))) | |
| print('-------------------------------------------------------------------------------------------') | |
| end |
main.lua
so how do I past the script in the main.lua
Pls
yes
Am Sa., 30. Mai 2026 um 12:42 Uhr schrieb punnakhon007-ui <
***@***.***>:
… ***@***.**** commented on this gist.
------------------------------
Pls
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/soumith/ce6b4164dd16f4bfce37#gistcomment-6175362>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B6DOWE2ABGB5VPCLZLWV5Y345K3LBBFHORZGSZ3HMVZKMY3SMVQXIZNMON2WE2TFMN2F65DZOBS2WR3JON2EG33NNVSW45FGORXXA2LDOOIYFJDUPFYGLJDHNFZXJJLWMFWHKZNIGMYTMOJXHAYTHKTBOR2HE2LCOV2GK44TQKSXMYLMOVS2SMRYHEYTONZTGMY2I3TBNVS2QYLDORXXEX3JMSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DF>
.
You are receiving this email because you are subscribed to this thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sha vi ebaaiiata
Kkk
Kk
I cant get the script
Fr jenne i cant this is just pure dum
Like wth bro
MAKE IT GODDAMN EASY
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Community