Module Owl_computation_engine.Flatten

Parameters

Signature

include module type of struct include Engine end
module Graph = Engine.Graph
Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

Execute actual computation included in each CGraph element (of output type float) in an array.

val eval_graph : Graph.graph -> unit

Execute actual computation of a computation graph.

include module type of struct include Graph end
module Optimiser = Graph.Optimiser
type graph = Engine.Graph.graph
val shape_or_value : Optimiser.Operator.Symbol.Shape.Type.t -> string
val graph_to_dot : graph -> string
val graph_to_trace : graph -> string
val save_graph : 'a -> string -> unit
val load_graph : string -> 'a * 'b
val invalidate_rvs : graph -> unit
val is_iopair_safe : 'a Owl_graph.node -> 'a Owl_graph.node -> bool
val update_iopair : graph -> unit
val remove_unused_iopair : 'a Owl_graph.node array -> 'b array -> 'a Owl_graph.node array * 'b array
val optimise : graph -> unit
include module type of struct include Optimiser end
module Operator = Optimiser.Operator
val estimate_complexity : 'a Owl_graph.node array -> int * int
val optimise_nodes : Operator.Symbol.Shape.Type.attr Owl_graph.node array -> unit
include module type of struct include Operator end
module Symbol = Operator.Symbol
val empty : int array -> Symbol.Shape.Type.arr
val zeros : int array -> Symbol.Shape.Type.arr
val ones : int array -> Symbol.Shape.Type.arr
val create : int array -> Symbol.Shape.Type.elt -> Symbol.Shape.Type.arr
val sequential : ?a:Symbol.Shape.Type.elt -> ?step:Symbol.Shape.Type.elt -> int array -> Symbol.Shape.Type.arr
val gaussian : ?mu:Symbol.Shape.Type.elt -> ?sigma:Symbol.Shape.Type.elt -> int array -> Symbol.Shape.Type.arr
val bernoulli : ?p:Symbol.Shape.Type.elt -> int array -> Symbol.Shape.Type.arr
val init : int array -> (int -> Symbol.Shape.Type.elt) -> Symbol.Shape.Type.arr
val init_nd : int array -> (int array -> Symbol.Shape.Type.elt) -> Symbol.Shape.Type.arr
val shape : Symbol.Shape.Type.arr -> int array
val numel : Symbol.Shape.Type.arr -> int
val set : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.elt -> unit
val get_slice : int list list -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val set_slice : int list list -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> unit
val copy_ : out:'a -> 'b -> 'c
val reset : Symbol.Shape.Type.arr -> unit
val reshape : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val tile : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val repeat : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val expand : ?hi:bool -> Symbol.Shape.Type.arr -> int -> Symbol.Shape.Type.arr
val squeeze : ?axis:int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val concatenate : ?axis:int -> Symbol.Shape.Type.arr array -> Symbol.Shape.Type.arr
val stack : ?axis:int -> Symbol.Shape.Type.arr array -> Symbol.Shape.Type.arr
val split : ?axis:int -> 'a -> 'b -> 'c
val draw : ?axis:int -> Symbol.Shape.Type.arr -> int -> Symbol.Shape.Type.arr * 'a array
val lazy_print : ?max_row:int -> ?max_col:int -> ?header:bool -> ?fmt:(Symbol.Shape.Type.Device.A.elt -> string) -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val print : ?max_row:'a -> ?max_col:'b -> ?header:'c -> ?fmt:'d -> 'e -> unit
val min : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val max : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val sum : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val sum_reduce : ?axis:int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val log_sum_exp : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val transpose_conv1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val transpose_conv2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val transpose_conv3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val dilated_conv1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val dilated_conv2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val dilated_conv3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val max_pool1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val max_pool2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val max_pool3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val avg_pool1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val avg_pool2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val avg_pool3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr
val upsampling2d : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val transpose_conv1d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val transpose_conv1d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val transpose_conv2d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val transpose_conv2d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val transpose_conv3d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val transpose_conv3d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val dilated_conv1d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val dilated_conv1d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val dilated_conv2d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val dilated_conv2d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val dilated_conv3d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val dilated_conv3d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val max_pool1d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val max_pool2d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val max_pool3d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val avg_pool1d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val avg_pool2d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val avg_pool3d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val upsampling2d_backward : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val row_num : Symbol.Shape.Type.arr -> int
val col_num : Symbol.Shape.Type.arr -> int
val rows : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr
val copy_row_to : Symbol.Shape.Type.arr -> 'a -> 'b -> unit
val copy_col_to : Symbol.Shape.Type.arr -> 'a -> 'b -> unit
val transpose : ?axis:int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr
val to_rows : Symbol.Shape.Type.arr -> 'a array
val to_cols : Symbol.Shape.Type.arr -> 'a array
val of_array : Symbol.Shape.Type.elt array -> int array -> Symbol.Shape.Type.arr
val of_arrays : Symbol.Shape.Type.elt array array -> Symbol.Shape.Type.arr
val to_arrays : Symbol.Shape.Type.arr -> Symbol.Shape.Type.elt array array
module Scalar = Operator.Scalar
module Mat = Operator.Mat
module Linalg = Operator.Linalg
include module type of struct include Symbol end
module Shape = Symbol.Shape
val op_to_str : Shape.Type.op -> string
val is_random_variable : Shape.Type.op -> bool
val refnum : 'a Owl_graph.node -> int
val node_shape : Shape.Type.attr Owl_graph.node -> int array
val node_numel : Shape.Type.attr Owl_graph.node -> int
val is_shape_unknown : Shape.Type.attr Owl_graph.node -> bool
val infer_shape_graph : Shape.Type.attr Owl_graph.node array -> unit
val shape_to_str : int array option array -> string
val node_to_str : Shape.Type.attr Owl_graph.node -> string
val node_to_arr : Shape.Type.t -> Shape.Type.arr
val arr_to_node : Shape.Type.arr -> Shape.Type.t
val node_to_elt : Shape.Type.t -> Shape.Type.elt
val elt_to_node : Shape.Type.elt -> Shape.Type.t
val make_node : ?name:string -> ?value:Shape.Type.Device.value array -> ?shape:int array option array -> ?freeze:bool -> ?reuse:bool -> ?state:Shape.Type.state -> Shape.Type.op -> Shape.Type.attr Owl_graph.node
val make_then_connect : ?shape:int array option array -> Shape.Type.op -> Shape.Type.attr Owl_graph.node array -> Shape.Type.attr Owl_graph.node
val var_arr : ?shape:int array -> string -> Shape.Type.arr
val var_elt : string -> Shape.Type.elt
val const_arr : string -> Shape.Type.Device.A.arr -> Shape.Type.arr
val const_elt : string -> Shape.Type.Device.A.elt -> Shape.Type.elt
val new_block_id : unit -> int
val make_empty_block : ?block_id:int -> int -> Shape.Type.block
val make_value_block : Shape.Type.Device.value -> Shape.Type.attr Owl_graph.node -> unit
val add_node_to_block : Shape.Type.attr Owl_graph.node -> Shape.Type.block -> unit
val get_active_node : Shape.Type.block -> Shape.Type.attr Owl_graph.node option
val set_active_node : Shape.Type.block -> Shape.Type.attr Owl_graph.node -> unit
val get_block_id : Shape.Type.attr Owl_graph.node -> int
val set_value : Shape.Type.attr Owl_graph.node -> Shape.Type.Device.value array -> unit
val set_operator : Shape.Type.attr Owl_graph.node -> Shape.Type.op -> unit
val set_reuse : Shape.Type.attr Owl_graph.node -> bool -> unit
val get_reuse : Shape.Type.attr Owl_graph.node -> bool
val is_shared : Shape.Type.attr Owl_graph.node -> bool
val is_var : Shape.Type.attr Owl_graph.node -> bool
val is_const : Shape.Type.attr Owl_graph.node -> bool
val is_node_arr : Shape.Type.attr Owl_graph.node -> bool
val is_node_elt : Shape.Type.attr Owl_graph.node -> bool
val is_assigned : Shape.Type.attr Owl_graph.node -> bool
val check_assigned : Shape.Type.attr Owl_graph.node -> unit
val is_valid : Shape.Type.attr Owl_graph.node -> bool
val validate : Shape.Type.attr Owl_graph.node -> unit
val invalidate : Shape.Type.attr Owl_graph.node -> unit
val invalidate_graph : Shape.Type.attr Owl_graph.node -> unit
val is_freeze : Shape.Type.attr Owl_graph.node -> bool
val freeze : Shape.Type.attr Owl_graph.node -> unit
val freeze_descendants : Shape.Type.attr Owl_graph.node array -> unit
val freeze_ancestors : Shape.Type.attr Owl_graph.node array -> unit
val unsafe_assign_arr : Shape.Type.arr -> Shape.Type.Device.A.arr -> unit
val assign_arr : Shape.Type.arr -> Shape.Type.Device.A.arr -> unit
val assign_elt : Shape.Type.elt -> Shape.Type.Device.A.elt -> unit
val float_to_elt : float -> Shape.Type.elt
val elt_to_float : Shape.Type.elt -> float
include module type of struct include Shape end
module Type = Shape.Type
val infer_shape : Type.op -> Type.attr Owl_graph.node array -> int array option array
include module type of struct include Type end
module Device = Type.Device
and block = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.block = {
  1. size : int;
  2. block_id : int;
  3. mutable active : t option;
  4. mutable memory : Device.value;
  5. mutable nodes : t list;
}
and attr = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.attr = {
  1. mutable op : op;
  2. mutable freeze : bool;
  3. mutable reuse : bool;
  4. mutable state : state;
  5. mutable shape : int array option array;
  6. mutable value : Device.value array;
  7. mutable block : block array option;
}
and op = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.op =
  1. | Noop
  2. | Var
  3. | Const
  4. | Empty of int array
  5. | Zeros of int array
  6. | Ones of int array
  7. | Create of int array
  8. | Sequential of int array
  9. | Uniform of int array
  10. | Gaussian of int array
  11. | Bernoulli of int array
  12. | Init of int array * int -> elt
  13. | Get of int array
  14. | Set of int array
  15. | GetSlice of int list list
  16. | SetSlice of int list list
  17. | GetFancy of Owl_types_common.index list
  18. | SetFancy of Owl_types_common.index list
  19. | Copy
  20. | Reset
  21. | Reshape of int array
  22. | Reverse
  23. | Tile of int array
  24. | Repeat of int array
  25. | Pad of elt * int list list
  26. | Concatenate of int
  27. | Stack of int
  28. | Split of int * int array
  29. | Draw of int * int
  30. | Map of elt -> elt
  31. | Fold of int * elt -> elt -> elt
  32. | Scan of int * elt -> elt -> elt
  33. | OneHot of int
  34. | OfArray of int array
  35. | Delay of Device.A.arr -> Device.A.arr
  36. | DelayArray of int array * Device.A.arr array -> Device.A.arr
  37. | LazyPrint of int option * int option * bool option * (Device.A.elt -> string) option
  38. | Abs
  39. | Neg
  40. | Floor
  41. | Ceil
  42. | Round
  43. | Sqr
  44. | Sqrt
  45. | Log
  46. | Log2
  47. | Log10
  48. | Exp
  49. | Sin
  50. | Cos
  51. | Tan
  52. | Sinh
  53. | Cosh
  54. | Tanh
  55. | Asin
  56. | Acos
  57. | Atan
  58. | Asinh
  59. | Acosh
  60. | Atanh
  61. | Min of bool * int
  62. | Max of bool * int
  63. | Sum of bool * int
  64. | SumReduce of int array
  65. | Signum
  66. | Sigmoid
  67. | Relu
  68. | Dawsn
  69. | Min'
  70. | Max'
  71. | Sum'
  72. | LogSumExp'
  73. | LogSumExp of bool * int
  74. | L1norm'
  75. | L2norm'
  76. | L2NormSqr'
  77. | ClipByValue
  78. | ClipByL2norm
  79. | Pow
  80. | ScalarPow
  81. | PowScalar
  82. | Atan2
  83. | ScalarAtan2
  84. | Atan2Scalar
  85. | Hypot
  86. | Min2
  87. | Max2
  88. | Add
  89. | Sub
  90. | Mul
  91. | Div
  92. | AddScalar
  93. | SubScalar
  94. | MulScalar
  95. | DivScalar
  96. | ScalarAdd
  97. | ScalarSub
  98. | ScalarMul
  99. | ScalarDiv
  100. | FMA
  101. | EltEqual
  102. | EltNotEqual
  103. | EltLess
  104. | EltGreater
  105. | EltLessEqual
  106. | EltGreaterEqual
  107. | EltEqualScalar
  108. | EltNotEqualScalar
  109. | EltLessScalar
  110. | EltGreaterScalar
  111. | EltLessEqualScalar
  112. | EltGreaterEqualScalar
  113. | Conv1d of Owl_types_common.padding * int array
  114. | Conv2d of Owl_types_common.padding * int array
  115. | Conv3d of Owl_types_common.padding * int array
  116. | TransposeConv1d of Owl_types_common.padding * int array
  117. | TransposeConv2d of Owl_types_common.padding * int array
  118. | TransposeConv3d of Owl_types_common.padding * int array
  119. | DilatedConv1d of Owl_types_common.padding * int array * int array
  120. | DilatedConv2d of Owl_types_common.padding * int array * int array
  121. | DilatedConv3d of Owl_types_common.padding * int array * int array
  122. | MaxPool1d of Owl_types_common.padding * int array * int array
  123. | MaxPool2d of Owl_types_common.padding * int array * int array
  124. | MaxPool3d of Owl_types_common.padding * int array * int array
  125. | AvgPool1d of Owl_types_common.padding * int array * int array
  126. | AvgPool2d of Owl_types_common.padding * int array * int array
  127. | AvgPool3d of Owl_types_common.padding * int array * int array
  128. | UpSampling2d of int array
  129. | Conv1dBackwardInput of int array
  130. | Conv1dBackwardKernel of int array
  131. | Conv2dBackwardInput of int array
  132. | Conv2dBackwardKernel of int array
  133. | Conv3dBackwardInput of int array
  134. | Conv3dBackwardKernel of int array
  135. | TransposeConv1dBackwardInput of int array
  136. | TransposeConv1dBackwardKernel of int array
  137. | TransposeConv2dBackwardInput of int array
  138. | TransposeConv2dBackwardKernel of int array
  139. | TransposeConv3dBackwardInput of int array
  140. | TransposeConv3dBackwardKernel of int array
  141. | DilatedConv1dBackwardInput of int array * int array
  142. | DilatedConv1dBackwardKernel of int array * int array
  143. | DilatedConv2dBackwardInput of int array * int array
  144. | DilatedConv2dBackwardKernel of int array * int array
  145. | DilatedConv3dBackwardInput of int array * int array
  146. | DilatedConv3dBackwardKernel of int array * int array
  147. | MaxPool1dBackward of Owl_types_common.padding * int array * int array
  148. | MaxPool2dBackward of Owl_types_common.padding * int array * int array
  149. | MaxPool3dBackward of Owl_types_common.padding * int array * int array
  150. | AvgPool1dBackward of Owl_types_common.padding * int array * int array
  151. | AvgPool2dBackward of Owl_types_common.padding * int array * int array
  152. | AvgPool3dBackward of Owl_types_common.padding * int array * int array
  153. | UpSampling2dBackward of int array
  154. | RowNum
  155. | ColNum
  156. | Row
  157. | Rows of int array
  158. | CopyRowTo
  159. | CopyColTo
  160. | Dot of bool * bool * elt * elt
  161. | Inv
  162. | Trace
  163. | Transpose of int array
  164. | ToRows
  165. | OfRows
  166. | Scalar_Add
  167. | Scalar_Sub
  168. | Scalar_Mul
  169. | Scalar_Div
  170. | Scalar_Pow
  171. | Scalar_Atan2
  172. | Scalar_Abs
  173. | Scalar_Neg
  174. | Scalar_Sqr
  175. | Scalar_Sqrt
  176. | Scalar_Exp
  177. | Scalar_Log
  178. | Scalar_Log2
  179. | Scalar_Log10
  180. | Scalar_Signum
  181. | Scalar_Floor
  182. | Scalar_Ceil
  183. | Scalar_Round
  184. | Scalar_Sin
  185. | Scalar_Cos
  186. | Scalar_Tan
  187. | Scalar_Sinh
  188. | Scalar_Cosh
  189. | Scalar_Tanh
  190. | Scalar_Asin
  191. | Scalar_Acos
  192. | Scalar_Atan
  193. | Scalar_Asinh
  194. | Scalar_Acosh
  195. | Scalar_Atanh
  196. | Scalar_Relu
  197. | Scalar_Dawsn
  198. | Scalar_Sigmoid
  199. | Fused_Adagrad of float * float
include module type of struct include Device end
module A = Device.A
val make_device : unit -> device
val arr_to_value : A.arr -> value
val value_to_arr : value -> A.arr
val elt_to_value : A.elt -> value
val value_to_elt : value -> A.elt
val value_to_float : value -> float
val is_arr : value -> bool
val is_elt : value -> bool