Created
January 18, 2018 10:43
-
-
Save considerate/6c0125cb184f15168ca997a69f95f4bd to your computer and use it in GitHub Desktop.
Gradients Accelerate
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
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 2) [0.0,0.0]) in | |
let a3 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 1 x1 | |
in (a1!x2) + (a2!Z :. indexHead x2)) | |
* | |
(a3!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a1) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a1!x0) + (a2!Z :. indexHead x0)))))) | |
in let a1 = use (Array (Z :. 2 :. 1) [0.0,1.0]) in | |
let a2 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 2 :. 1) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 2 x1 | |
in (let x3 = a0!x2 | |
in x3 * (1.0 - x3)) | |
* | |
((a0!x2) - (a1!x2))) | |
* | |
(a2 | |
! | |
(let x2 = indexSlice indexAny :. 2 :. All :. All x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3))) | |
in fold1 (\x0 x1 -> x0 + x1) a0 | |
in fold1 | |
(\x0 x1 -> x0 + x1) | |
(Delayed | |
Z :. 2 :. 2 | |
(\x0 -> let x1 = | |
let x1 = | |
let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in x1 | |
in a0!x1 | |
in x1))) |
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
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 2) [0.0,0.0]) in | |
let a3 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 1 x1 | |
in (a1!x2) + (a2!Z :. indexHead x2)) | |
* | |
(a3!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a1) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a1!x0) + (a2!Z :. indexHead x0)))))) | |
in let a1 = use (Array (Z :. 2 :. 1) [0.0,1.0]) | |
in fold1 | |
(\x0 x1 -> x0 + x1) | |
(Delayed | |
Z :. 1 :. 2 | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = a0!x1 | |
in x2 * (1.0 - x2)) | |
* | |
((a0!x1) - (a1!x1))))) |
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
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
let a1 = | |
let a1 = | |
let a1 = | |
let a1 = | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a2 = fold1 (\x0 x1 -> x0 + x1) a1 in | |
let a3 = use (Array (Z :. 2) [0.0,0.0]) in | |
let a4 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 1 x1 | |
in (a2!x2) + (a3!Z :. indexHead x2)) | |
* | |
(a4!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a2 = fold1 (\x0 x1 -> x0 + x1) a1 in | |
let a3 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a2) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a2!x0) + (a3!Z :. indexHead x0)))))) | |
in let a2 = use (Array (Z :. 2 :. 1) [0.0,1.0]) in | |
let a3 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 2 :. 1) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 2 x1 | |
in (let x3 = a1!x2 | |
in x3 * (1.0 - x3)) | |
* | |
((a1!x2) - (a2!x2))) | |
* | |
(a3 | |
! | |
(let x2 = indexSlice indexAny :. 2 :. All :. All x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3))) | |
in fold1 (\x0 x1 -> x0 + x1) a1 | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0 | |
! | |
(let x2 = indexSlice indexAny :. All :. All :. 2 x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in fold1 (\x0 x1 -> x0 + x1) a0 |
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
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 2) [0.0,0.0]) | |
in generate (intersect (shape a1) (Z :. 2 :. 2)) (\x0 -> (a1!x0) + (a2!Z :. indexHead x0)) | |
in let a1 = | |
let a1 = | |
let a1 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 1 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a2 = fold1 (\x0 x1 -> x0 + x1) a1 in | |
let a3 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a2) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a2!x0) + (a3!Z :. indexHead x0)))))) | |
in let a2 = use (Array (Z :. 2 :. 1) [0.0,1.0]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0 | |
! | |
(let x2 = indexSlice indexAny :. All :. All :. 1 x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3)) | |
* | |
(let x2 = indexSlice indexAny :. 2 :. All :. All x1 | |
in (let x3 = a1!x2 | |
in x3 * (1.0 - x3)) | |
* | |
((a1!x2) - (a2!x2)))) | |
in fold1 (\x0 x1 -> x0 + x1) a0 | |
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
(let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
let a1 = | |
let a1 = | |
let a1 = | |
let a1 = | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a2 = fold1 (\x0 x1 -> x0 + x1) a1 in | |
let a3 = use (Array (Z :. 2) [0.0,0.0]) in | |
let a4 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 1 x1 | |
in (a2!x2) + (a3!Z :. indexHead x2)) | |
* | |
(a4!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a2 = fold1 (\x0 x1 -> x0 + x1) a1 in | |
let a3 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a2) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a2!x0) + (a3!Z :. indexHead x0)))))) | |
in let a2 = use (Array (Z :. 2 :. 1) [0.0,1.0]) in | |
let a3 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 2 :. 1) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 2 x1 | |
in (let x3 = a1!x2 | |
in x3 * (1.0 - x3)) | |
* | |
((a1!x2) - (a2!x2))) | |
* | |
(a3 | |
! | |
(let x2 = indexSlice indexAny :. 2 :. All :. All x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3))) | |
in fold1 (\x0 x1 -> x0 + x1) a1 | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0 | |
! | |
(let x2 = indexSlice indexAny :. All :. All :. 2 x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in fold1 (\x0 x1 -> x0 + x1) a0,let a0 = | |
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 2) [0.0,0.0]) in | |
let a3 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 1 x1 | |
in (a1!x2) + (a2!Z :. indexHead x2)) | |
* | |
(a3!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a1) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a1!x0) + (a2!Z :. indexHead x0)))))) | |
in let a1 = use (Array (Z :. 2 :. 1) [0.0,1.0]) in | |
let a2 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 2 :. 1) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 2 x1 | |
in (let x3 = a0!x2 | |
in x3 * (1.0 - x3)) | |
* | |
((a0!x2) - (a1!x2))) | |
* | |
(a2 | |
! | |
(let x2 = indexSlice indexAny :. 2 :. All :. All x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3))) | |
in fold1 (\x0 x1 -> x0 + x1) a0 | |
in fold1 | |
(\x0 x1 -> x0 + x1) | |
(Delayed | |
Z :. 2 :. 2 | |
(\x0 -> let x1 = | |
let x1 = | |
let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in x1 | |
in a0!x1 | |
in x1))) | |
<| (let a0 = | |
let a0 = | |
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 2) [0.0,0.0]) | |
in generate (intersect (shape a1) (Z :. 2 :. 2)) (\x0 -> (a1!x0) + (a2!Z :. indexHead x0)) | |
in let a1 = | |
let a1 = | |
let a1 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 1 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a2 = fold1 (\x0 x1 -> x0 + x1) a1 in | |
let a3 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a2) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a2!x0) + (a3!Z :. indexHead x0)))))) | |
in let a2 = use (Array (Z :. 2 :. 1) [0.0,1.0]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0 | |
! | |
(let x2 = indexSlice indexAny :. All :. All :. 1 x1 in | |
let x3 = indexTail x2 | |
in indexTail x3 :. indexHead x2 :. indexHead x3)) | |
* | |
(let x2 = indexSlice indexAny :. 2 :. All :. All x1 | |
in (let x3 = a1!x2 | |
in x3 * (1.0 - x3)) | |
* | |
((a1!x2) - (a2!x2)))) | |
in fold1 (\x0 x1 -> x0 + x1) a0,let a0 = | |
let a0 = | |
let a0 = | |
let a0 = use | |
(Array (Z :. 2 :. 2) [2.0250376117435733,18.7039690333509,25.755929376845543,35.32123856353882]) in | |
let a1 = | |
use | |
(Array | |
(Z :. 2 :. 2) [-0.6815056734344778,-0.547995469029023,0.18205115397801463,-0.5903723633735871]) | |
in generate | |
(Z :. 2 :. 2 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (a0!(indexSlice indexAny :. All :. All :. 2 x1)) | |
* | |
(a1!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 2) [0.0,0.0]) in | |
let a3 = use (Array (Z :. 2 :. 1) [-0.4856882029022902,-0.3768385359240648]) | |
in generate | |
(Z :. 2 :. 1 :. 2) | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = indexSlice indexAny :. All :. All :. 1 x1 | |
in (a1!x2) + (a2!Z :. indexHead x2)) | |
* | |
(a3!(indexSlice indexAny :. 2 :. All :. All x1))) | |
in let a1 = fold1 (\x0 x1 -> x0 + x1) a0 in | |
let a2 = use (Array (Z :. 1) [0.0]) | |
in generate | |
(intersect (shape a1) (Z :. 2 :. 1)) | |
(\x0 -> 1.0 / (1.0 + (exp (negate ((a1!x0) + (a2!Z :. indexHead x0)))))) | |
in let a1 = use (Array (Z :. 2 :. 1) [0.0,1.0]) | |
in fold1 | |
(\x0 x1 -> x0 + x1) | |
(Delayed | |
Z :. 1 :. 2 | |
(\x0 -> let x1 = | |
let x1 = indexTail x0 | |
in indexTail x1 :. indexHead x0 :. indexHead x1 | |
in (let x2 = a0!x1 | |
in x2 * (1.0 - x2)) | |
* | |
((a0!x1) - (a1!x1))))) | |
<| | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment