CIFAR10 VGG Example
This example demonstrates how to build a VGG-like convolutional neural network for CIFAR10 dataset.
| #require "owl_opencl";; | |
| let prog_s = " | |
| __kernel void hello_kernel(__global const float *a, | |
| __global const float *b, | |
| __global float *result) | |
| { | |
| int gid = get_global_id(0); | |
| result[gid] = a[gid] + b[gid]; | |
| } |
| c18fdd78b99283a102a721a0fe4f214b |
| let x = Arr.sequential [|2;3;4|];; | |
| Owl_slicing_ext.(get_slice_list_typ [] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ R[]; R[]; R[]] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ I 1; R[]; R[]] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ I 1; I 2; R[]] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ I 1; I 0; I 3] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ I 1; I 0; I 2] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ L [0;1]; I 0; I 2] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ R [-1;0]; I 0; R []] x);; | |
| Owl_slicing_ext.(get_slice_list_typ [ R [-1;0]; I 0; R [1;2]] x);; |
| 217ef87bc36845c4e78e398d52bc4c5b |
CIFAR10 VGG Example
This example demonstrates how to build a VGG-like convolutional neural network for CIFAR10 dataset.
| 5ca2fdebb0ccb9ecee6f4331972a9087 |
| let x = Mat.uniform 4 4;; | |
| let x = Mat.symmetric x;; | |
| let v, w = Linalg.D.eig x;; | |
| let w = Dense.Matrix.Z.re w;; | |
| let v = Dense.Matrix.Z.re v;; | |
| let v0 = Mat.col v 0;; | |
| let a = Mat.(x *@ v0);; | |
| let b = Mat.(v0 *$ w.{0,0});; | |
| Mat.(a =~ b);; |
| module CI = Cstubs_internals | |
| external owl_stub_1_LAPACKE_sbdsdc | |
| : int -> char -> char -> int -> _ CI.fatptr -> _ CI.fatptr -> | |
| _ CI.fatptr -> int -> _ CI.fatptr -> int -> _ CI.fatptr -> _ CI.fatptr -> | |
| int = "owl_stub_1_LAPACKE_sbdsdc_byte12" "owl_stub_1_LAPACKE_sbdsdc" | |
| external owl_stub_2_LAPACKE_dbdsdc | |
| : int -> char -> char -> int -> _ CI.fatptr -> _ CI.fatptr -> | |
| _ CI.fatptr -> int -> _ CI.fatptr -> int -> _ CI.fatptr -> _ CI.fatptr -> |
| function f00() | |
| x = rand(1000, 2000) | |
| t0 = time() | |
| LinAlg.LAPACK.gesvd!('A','A',x) | |
| t1 = time() | |
| @printf "time:\t\t%.8f\n" (t1 -t0) | |
| end | |
| function f00() |
| ```ocaml | |
| Mat.map (min 5.) x;; | |
| ``` | |
| ```ocaml | |
| let x = Mat.uniform 5 5;; | |
| Mat.filter (( < ) 0.5) x;; | |
| ... | |
| ``` |