From 8b71fa91383e902b2bd03d6d786d59463ae6ab89 Mon Sep 17 00:00:00 2001 From: "J.Stark" Date: Thu, 27 Jun 2024 18:18:53 +0200 Subject: [PATCH] coding... --- examples/README.md | 1 - examples/computation_graph_02.ml | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/README.md b/examples/README.md index eed9afab5..e69de29bb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1 +0,0 @@ -The examples in this folder are made based on the OCaml's toplevel and Owl's Zoo system. Please refer to [Tutorial 9: Scripting and Zoo System](https://github.com/ryanrhymes/owl/wiki/Tutorial:-Scripting-and-Zoo-System). diff --git a/examples/computation_graph_02.ml b/examples/computation_graph_02.ml index a7fcdd48e..d4d4f42f5 100755 --- a/examples/computation_graph_02.ml +++ b/examples/computation_graph_02.ml @@ -36,14 +36,14 @@ let visualise_mnist () = let _, adj0 = Graph.(backward network loss) in let inputs = [| xt |> A.unpack_arr |> G.arr_to_node |] in let s0_outputs = [| loss |> A.unpack_elt |> G.elt_to_node |] in - let s0 = G.make_graph inputs s0_outputs "mnist_loss" |> G.graph_to_dot in + let s0 = G.make_graph ~input:inputs ~output:s0_outputs "mnist_loss" |> G.graph_to_dot in Owl_io.write_file "cgraph_04_mnist_loss.dot" s0; Sys.command "dot -Tpdf cgraph_04_mnist_loss.dot -o cgraph_04_mnist_loss.pdf" |> ignore; let s1_outputs = adj0 |> Utils.Array.flatten |> Array.map (fun a -> A.unpack_arr a |> G.arr_to_node) in - let s1 = G.make_graph inputs s1_outputs "mnist_loss" |> G.graph_to_dot in + let s1 = G.make_graph ~input:inputs ~output:s1_outputs "mnist_loss" |> G.graph_to_dot in Owl_io.write_file "cgraph_04_mnist_grad.dot" s1; Sys.command "dot -Tpdf cgraph_04_mnist_grad.dot -o cgraph_04_mnist_grad.pdf" |> ignore @@ -67,14 +67,14 @@ let visualise_lstm () = let _, adj0 = Graph.(backward network loss) in let inputs = [| xt |> A.unpack_arr |> G.arr_to_node |] in let s0_outputs = [| loss |> A.unpack_elt |> G.elt_to_node |] in - let s0 = G.make_graph inputs s0_outputs "mnist_loss" |> G.graph_to_dot in + let s0 = G.make_graph ~input:inputs ~output:s0_outputs "mnist_loss" |> G.graph_to_dot in Owl_io.write_file "cgraph_04_lstm_loss.dot" s0; (* Sys.command "dot -Tpdf -Gnslimit=1 cgraph_04_lstm_loss.dot -o cgraph_04_lstm_loss.pdf" |> ignore; *) let s1_outputs = adj0 |> Utils.Array.flatten |> Array.map (fun a -> A.unpack_arr a |> G.arr_to_node) in - let s1 = G.make_graph inputs s1_outputs "mnist_loss" |> G.graph_to_dot in + let s1 = G.make_graph ~input:inputs ~output:s1_outputs "mnist_loss" |> G.graph_to_dot in Owl_io.write_file "cgraph_04_lstm_grad.dot" s1 (* Sys.command "dot -Tpdf -Gnslimit=1 cgraph_04_lstm_grad.dot -o cgraph_04_lstm_grad.pdf" |> ignore *)