Lazy Functor

This document is auto-generated for Owl’s APIs. #152 entries have been extracted. timestamp: 2018-04-16 13:12:54

Github: {Signature} {Implementation}

Type definition

type t

t is an abstract type to represent an expression, it is also an alias for type node. Type node is only for internal use in the module.

Core functions

val variable : ?name:string -> unit -> t

variable () creates a placeholder for the variable in the graph.

source code

val assign_arr : t -> A.arr -> unit

assign_arr x a assigns value a to x. x is the variable created by variable () function before. Note that assignment will invalidate all the nodes in the subgraph depending on x.

source code

val assign_elt : t -> A.elt -> unit

assign_elt x a assigns value a to x, simiar to assign_arr.

source code

val to_arr : t -> A.arr

to_arr x unpacks an ndarray from x of type t.

source code

val to_elt : t -> A.elt

to_elt x unpacks an element from x of type t.

source code

val of_arr : ?name:string -> A.arr -> t

of_arr x creates a constant value from x in the computation graph. The constant value cannot be re-assigned by assign_arr or assign_elt later.

source code

val of_elt : ?name:string -> A.elt -> t

of_elt x is similar to of_arr but used for the value of type elt.

source code

val eval : t -> unit

eval x evaluates the experssion represented by x. Note only the subgraph that x depends on will be evaluated rather than the whole graph.

source code

Printing functions

val pp_lazy : Format.formatter -> t -> unit

pp_lazy x pretty prints x.

source code

val to_trace : t list -> string

to_trace x returns the trace string that can be printed on the terminal for a list of given expressions. The trace shows the structure of the graph.

source code

val to_dot : t list -> string

to_dot x converts a list of experssions into graph using dot-formatted string. The returned string can be used for visualising the computation graph with third-party tool such as graphviz.

source code

val copy : t array -> t array

copy x

source code

Properties and manipulations

val is_var : t -> bool

is_var x returns true if x is a variable created by variable.

source code

val is_const : t -> bool

is_const x returns true if x is a const created by of_arr or of_elt.

source code

val refnum : t -> int

refnum x returns the number of x’s parents in the computation graph.

source code

val map : ?name:string -> (t array -> t) -> t array -> t

map f x is a general mechanism that allows you to plug in any functions into a compuation graph as a computation node in case the unary and binary math operators defined in this functor are not sufficient. Also because of map, we do not really need the control flow node in Owl as that in TensorFlow since map is more general can be used to implement arbitrary operations (almost).

f : t array -> t takes an array of t as inputs and outputs a constant value of t. This means the output must be wrapped up using either of_arr or of_elt function before returning the result.

source code

val tile : t -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val repeat : ?axis:int -> t -> int -> t

Refer to Dense.Ndarray.Generic.

source code

val concatenate : ?axis:int -> t array -> t

Refer to Dense.Ndarray.Generic.

source code

Unary operators

val abs : t -> t

Refer to Dense.Ndarray.Generic.

source code

val neg : t -> t

Refer to Dense.Ndarray.Generic.

source code

val conj : t -> t

Refer to Dense.Ndarray.Generic.

source code

val reci : t -> t

Refer to Dense.Ndarray.Generic.

source code

val signum : t -> t

Refer to Dense.Ndarray.Generic.

source code

val sqr : t -> t

Refer to Dense.Ndarray.Generic.

source code

val sqrt : t -> t

Refer to Dense.Ndarray.Generic.

source code

val cbrt : t -> t

Refer to Dense.Ndarray.Generic.

source code

val exp : t -> t

Refer to Dense.Ndarray.Generic.

source code

val exp2 : t -> t

Refer to Dense.Ndarray.Generic.

source code

val exp10 : t -> t

Refer to Dense.Ndarray.Generic.

source code

val expm1 : t -> t

Refer to Dense.Ndarray.Generic.

source code

val log : t -> t

Refer to Dense.Ndarray.Generic.

source code

val log2 : t -> t

Refer to Dense.Ndarray.Generic.

source code

val log10 : t -> t

Refer to Dense.Ndarray.Generic.

source code

val log1p : t -> t

Refer to Dense.Ndarray.Generic.

source code

val sin : t -> t

Refer to Dense.Ndarray.Generic.

source code

val cos : t -> t

Refer to Dense.Ndarray.Generic.

source code

val tan : t -> t

Refer to Dense.Ndarray.Generic.

source code

val asin : t -> t

Refer to Dense.Ndarray.Generic.

source code

val acos : t -> t

Refer to Dense.Ndarray.Generic.

source code

val atan : t -> t

Refer to Dense.Ndarray.Generic.

source code

val sinh : t -> t

Refer to Dense.Ndarray.Generic.

source code

val cosh : t -> t

Refer to Dense.Ndarray.Generic.

source code

val tanh : t -> t

Refer to Dense.Ndarray.Generic.

source code

val asinh : t -> t

Refer to Dense.Ndarray.Generic.

source code

val acosh : t -> t

Refer to Dense.Ndarray.Generic.

source code

val atanh : t -> t

Refer to Dense.Ndarray.Generic.

source code

val floor : t -> t

Refer to Dense.Ndarray.Generic.

source code

val ceil : t -> t

Refer to Dense.Ndarray.Generic.

source code

val round : t -> t

Refer to Dense.Ndarray.Generic.

source code

val trunc : t -> t

Refer to Dense.Ndarray.Generic.

source code

val fix : t -> t

Refer to Dense.Ndarray.Generic.

source code

val erf : t -> t

Refer to Dense.Ndarray.Generic.

source code

val erfc : t -> t

Refer to Dense.Ndarray.Generic.

source code

val relu : t -> t

Refer to Dense.Ndarray.Generic.

source code

val softplus : t -> t

Refer to Dense.Ndarray.Generic.

source code

val softsign : t -> t

Refer to Dense.Ndarray.Generic.

source code

val softmax : t -> t

Refer to Dense.Ndarray.Generic.

source code

val sigmoid : t -> t

Refer to Dense.Ndarray.Generic.

source code

val sum : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val prod : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val min : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val max : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val mean : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val var : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val std : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val l1norm : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val l2norm : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val cumsum : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val cumprod : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val cummin : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val cummax : ?axis:int -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val sum' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val prod' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val min' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val max' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val mean' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val var' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val std' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val l1norm' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val l2norm' : t -> t

Refer to Dense.Ndarray.Generic.

source code

val l2norm_sqr' : t -> t

Refer to Dense.Ndarray.Generic.

source code

Binary operators

val add : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val sub : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val mul : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val div : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val pow : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val dot : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val atan2 : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val hypot : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val fmod : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val min2 : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val max2 : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val add_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val sub_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val mul_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val div_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val pow_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val atan2_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val fmod_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_add : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_sub : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_mul : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_div : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_pow : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_atan2 : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val scalar_fmod : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val conv1d : ?padding:padding -> t -> t -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val conv2d : ?padding:padding -> t -> t -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val conv3d : ?padding:padding -> t -> t -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val max_pool1d : ?padding:padding -> t -> int array -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val max_pool2d : ?padding:padding -> t -> int array -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val max_pool3d : ?padding:padding -> t -> int array -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val avg_pool1d : ?padding:padding -> t -> int array -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val avg_pool2d : ?padding:padding -> t -> int array -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val avg_pool3d : ?padding:padding -> t -> int array -> int array -> t

Refer to Dense.Ndarray.Generic.

source code

val conv1d_backward_input : t -> t -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val conv1d_backward_kernel : t -> t -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val conv2d_backward_input : t -> t -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val conv2d_backward_kernel : t -> t -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val conv3d_backward_input : t -> t -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val conv3d_backward_kernel : t -> t -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val max_pool1d_backward : padding -> t -> int array -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val max_pool2d_backward : padding -> t -> int array -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val avg_pool1d_backward : padding -> t -> int array -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val avg_pool2d_backward : padding -> t -> int array -> int array -> t -> t

Refer to Dense.Ndarray.Generic.

source code

Comparion functions

val elt_equal : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_not_equal : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_less : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_greater : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_less_equal : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_greater_equal : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_equal_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_not_equal_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_less_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_greater_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_less_equal_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

val elt_greater_equal_scalar : t -> t -> t

Refer to Dense.Ndarray.Generic.

source code

Advanced operations

val invalidate : t -> unit

invalidate x set the status of x to Invalid. Therefore the value of x will be re-computed when in the future evaluation.

source code

val id : t -> int

id x retrieves the id number of x.

val name : t -> string

name x retrieves the name of x.

source code

val get_by_id : t -> int -> t

get_by_id x id retrieves the node with the given id in the subgraph of x.

source code

val get_by_name : t -> string -> t array

get_by_name x name retrieves the node with the given name in the subgraph of x.

source code