sourceextensions/blender/demos/relu-softmax.xtl

1⍝│ Blender, 5: ReLU and softmax, arrays to video. A tiny network's 2⍝│ layers, run by X_eTaL-gpu's Accel library (the functions its GPU 3⍝│ runs), shown as bars: ReLU turns z1's negatives to 0, softmax turns 4⍝│ each row of z2 into two shares of 1, a step at a time. Every bar's 5⍝│ place, size, color and timing, every label and the camera's path 6⍝│ are arrays worked out in X_eTaL (demos/ReluSoftmax.xtl); Video.xtl 7⍝│ writes them into the script Blender runs. Explained step by step in 8⍝│ docs/literate/relu-softmax.org. 9⍝│ Run: just demo blender relu-softmax (a few minutes: 901 frames) 10 11"bl:" u̲se< "Blender" 12"bp:" u̲se< "Bpy" 13"vd:" u̲se< "Video" 14"rs:" u̲se< "ReluSoftmax" 15 16⍝ five stills (the documents' pictures), then every frame as the video 17script ← ((1920, 1080) ʳˢs̲cene 0) c̲at ((2.0 8.0 14.0 23.0 28.0, "relu-softmax") ᵛᵈs̲tills 0) c̲at (ᵛᵈr̲ender "relu-softmax.mp4") c̲at ᵛᵈreport 18_ ← "work/explain/run.py" ᵇˡw̲rite! ᵇᵖlauncher 19_ ← "work/explain/relu-softmax.py" ᵇˡw̲rite! script 20"rendering five stills and 30 seconds (901 frames) with Blender (EEVEE) ..." 21r ← "work/explain/run.py" ᵇˡr̲un! "work/explain/relu-softmax.py work/explain/out" 22"the run, and the error lines in Blender's log:" 23lines ← (n̲ot r = f̲irst "\n") p̲artition r 24d̲isclose 1 s̲elect lines 25d̲isclose 2 s̲elect lines 26"what Blender made:" 27ᵇˡr̲ead "work/explain/out/report.txt"