Commit 4c2cb7d4 authored by Julien Girard-Satabin's avatar Julien Girard-Satabin
Browse files

added count of neurons in vertex

parent ceb6ab6a
......@@ -191,9 +191,9 @@ module Tensor = struct
let new_coords = all_coords new_sh in
{data=(
List.fold new_coords ~init:(create new_sh)
~f:(fun acc new_idx ->
set_idx acc new_idx
(get_idx t (permute_two_last new_idx)))).data;
~f:(fun acc new_idx ->
set_idx acc new_idx
(get_idx t (permute_two_last new_idx)))).data;
shape=new_sh}
(* Unit tests *)
let%test_module "Test Tensor" =
......@@ -320,6 +320,9 @@ module Vertex = struct
let is_data_node t = match get_tensor t with
| None -> false
| Some _ -> true
let num_neurons t = match get_shape t with
| [] -> 0
| l -> List.fold_left ~init:1 ~f:(fun x acc -> x*acc) l
end
module Edge = struct
......
......@@ -67,13 +67,13 @@ module Tensor : sig
val set_idx : t -> shape -> t_val -> t
(** [all_rows t] returns a list of all Row within [t]
*)
*)
val all_rows : t -> fdata list
(** [num_neurons sh] returns the total number of neurons
given a shape
*)
*)
val num_neurons : shape -> int
......@@ -174,6 +174,7 @@ module Vertex : sig
val get_op : t -> operator
val get_tensor : t -> Tensor.t option
val is_data_node : t -> bool
val num_neurons : t -> int
end
module Edge :
sig
......@@ -191,7 +192,7 @@ end
- unique id
- name coming from the original model, if it exists
- shape of the tensor resulting from the application of
the node operation, if it exist
the node operation, if it exist
- operation performed
- parameters of the operation
- an optional tensor storing the data
......@@ -212,19 +213,19 @@ val vertex_list : NierCFG.t -> Vertex.t list
val preds : NierCFG.t -> Vertex.t -> Vertex.t list
(** [preds_names g v] returns a list of names of predecessors nodes
*)
*)
val preds_names : NierCFG.t -> Vertex.t -> string list
val succs : NierCFG.t -> Vertex.t -> Vertex.t list
(** [succs_names g v] returns a list of names of predecessors nodes
*)
*)
val succs_names : NierCFG.t -> Vertex.t -> string list
(** [input_node g] returns the nodes considered as describing the inputs
of the neural network.
*)
*)
val input_nodes : NierCFG.t -> Vertex.t list
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment