Skip to content

Instantly share code, notes, and snippets.

View ryanrhymes's full-sized avatar
🎯
Focusing

Liang Wang ryanrhymes

🎯
Focusing
View GitHub Profile
@ryanrhymes
ryanrhymes / gist.id
Last active February 13, 2018 12:52
Perf_common provides basic functions for Owl's performance test
5ca2fdebb0ccb9ecee6f4331972a9087
@ryanrhymes
ryanrhymes / #readme.md
Last active May 18, 2018 18:15
CIFAR10 CNN Example

CIFAR10 VGG Example

This example demonstrates how to build a VGG-like convolutional neural network for CIFAR10 dataset.

@ryanrhymes
ryanrhymes / gist.id
Last active June 7, 2018 12:29
A Collection of Text Corpora for Owl's Experiment
217ef87bc36845c4e78e398d52bc4c5b
@ryanrhymes
ryanrhymes / test_slice.ml
Last active August 21, 2017 01:22
test new slicing function
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);;
@ryanrhymes
ryanrhymes / gist.id
Last active August 28, 2017 12:47
Owl's Tutorial at CUFP 2017
c18fdd78b99283a102a721a0fe4f214b
@ryanrhymes
ryanrhymes / exp_opencl.ml
Last active September 23, 2017 11:26
opencl experiment
#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];
}
#require "owl_opencl";;
let x0 = Dense.Ndarray.S.uniform [|5;5|];;
let x1 = Dense.Ndarray.S.uniform [|5;5|];;
let x2 = Dense.Ndarray.S.uniform [|5;5|];;
let x3 = Owl_opencl_dense.(add (Arr x0) (Arr x1));;
let x4 = Owl_opencl_dense.(add x3 (Arr x2));;
Owl_opencl_dense.eval x4;;
#require "owl_opencl";;
open Owl_opencl_operand;;
let x = Arr (Dense.Ndarray.S.uniform [|10;10|]);;
let y = Owl_opencl_dense.add_scalar x (F 1.);;
let z = Owl_opencl_dense.cos y;;
eval z;;
#require "owl_opencl";;
open Owl_opencl_operand;;
module M = Owl_lazy.Make (Arr);;
let x = Arr.uniform [|8;8|];;
let a = M.of_ndarray x;;
let b = M.(a |> sin |> cos);;
M._eval_term b;;
module M = Owl_lazy.Make (Arr);;
let x = Arr.uniform [|8;8|];;
let y = Arr.uniform [|8;8|];;
(* find the root inputs of [x] *)
let find_roots x =
let s = Owl_utils.Stack.make () in
let rec _find x =
Array.iter (fun n ->
if n.op = Noop then Owl_utils.Stack.push s n
else _find n
) x.prev
in
_find x;