package owl-base

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Owl_algodiff_generic.MakeSource

Parameters

Signature

include Owl_algodiff_core_sig.Sig with type A.arr = A.arr with type A.elt = A.elt
Sourcemodule A : Owl_types_ndarray_algodiff.Sig with type arr = A.arr with type elt = A.elt
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
Sourcetype t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t ref * op * int ref * int * int ref
Sourceand adjoint = t -> t ref -> (t * t) list -> (t * t) list
Sourceand register = t list -> t list
Sourceand label = string * t list
Core functions
Sourceval tag : unit -> int

TODO

Sourceval primal : t -> t

TODO

Sourceval primal' : t -> t

TODO

Sourceval zero : t -> t

TODO

Sourceval reset_zero : t -> t

TODO

Sourceval tangent : t -> t

TODO

Sourceval adjref : t -> t ref

TODO

Sourceval adjval : t -> t

TODO

Sourceval shape : t -> int array

TODO

Sourceval is_float : t -> bool

TODO

Sourceval is_arr : t -> bool

TODO

Sourceval row_num : t -> int

number of rows

Sourceval col_num : t -> int

number of columns

Sourceval numel : t -> int

number of elements

Sourceval clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

Sourceval clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

Sourceval copy_primal' : t -> t

TODO

Sourceval tile : t -> int array -> t

TODO

Sourceval repeat : t -> int array -> t

TODO

Sourceval pack_elt : A.elt -> t

convert from elt type to t type.

Sourceval unpack_elt : t -> A.elt

convert from t type to elt type.

Sourceval pack_flt : float -> t

convert from float type to t type.

Sourceval _f : float -> t

A shortcut function for F A.(float_to_elt x).

Sourceval unpack_flt : t -> float

convert from t type to float type.

Sourceval pack_arr : A.arr -> t

convert from arr type to t type.

Sourceval unpack_arr : t -> A.arr

convert from t type to arr type.

Sourceval deep_info : t -> string

TODO

Sourceval type_info : t -> string

TODO

Sourceval error_binop : string -> t -> t -> 'a

TODO

Sourceval error_uniop : string -> t -> 'a

TODO

Sourceval make_forward : t -> t -> int -> t

TODO

Sourceval make_reverse : t -> int -> t

TODO

Sourceval reverse_prop : t -> t -> unit

TODO

Sourceval diff : (t -> t) -> t -> t

diff f x returns the exat derivative of a function f : scalar -> scalar at point x. Simply calling diff f will return its derivative function g of the same type, i.e. g : scalar -> scalar.

Keep calling this function will give you higher-order derivatives of f, i.e. f |> diff |> diff |> diff |> ...

Sourceval diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

Sourceval grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

Sourceval grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

Sourceval jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

Sourceval jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

Sourceval jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

Sourceval jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

Sourceval jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

Sourceval jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

Sourceval hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

Sourceval hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

Sourceval hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

Sourceval hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

Sourceval laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

Sourceval laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

Sourceval gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

Sourceval gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

Sourceval gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

Sourceval gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f x v)

include Owl_algodiff_ops_sig.Sig with type t := t and type elt := A.elt and type arr := A.arr and type op := op
Sourcemodule Builder : Owl_algodiff_ops_builder_sig.Sig with type t := t and type elt := A.elt and type arr := A.arr and type op := op
Supported Maths functions
Sourcemodule Maths : sig ... end
Supported Linalg functions
Sourcemodule Linalg : sig ... end
Supported Neural Network functions
Sourcemodule NN : sig ... end
Supported Mat functions
Sourcemodule Mat : sig ... end
Supported Arr functions
Sourcemodule Arr : sig ... end
Helper functions
include Owl_algodiff_graph_convert_sig.Sig with type t := t
Sourceval to_trace : t list -> string

to_trace [t0; t1; ...] outputs the trace of computation graph on the terminal in a human-readable format.

Sourceval to_dot : t list -> string

to_dot [t0; t1; ...] outputs the trace of computation graph in the dot file format which you can use other tools further visualisation, such as Graphviz.

Sourceval pp_num : Format.formatter -> t -> unit

pp_num t pretty prints the abstract number used in Algodiff.

OCaml

Innovation. Community. Security.