package owl-base

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

Module Owl_algodiff_core.MakeSource

Parameters

Signature

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

start global tagging counter

Sourceval primal : t -> t

get primal component of DF or DR type

Sourceval primal' : t -> t

iteratively get primal component of DF or DR type until the component itself is not DF/DR

Sourceval zero : t -> t

return a zero value, which type decided by the input value

Sourceval reset_zero : t -> t

reset_zero x iteratively resets all elements included in x

Sourceval tangent : t -> t

get the tangent component of input, if the data type is suitable

Sourceval adjref : t -> t ref

get the adjref component of input, if the data type is suitable

Sourceval adjval : t -> t

get the adjval component of input, if the data type is suitableTODO

Sourceval shape : t -> int array

get the shape of primal' value of input

Sourceval is_float : t -> bool

check if input is of float value; if input is of type DF/DR, check its primal' value

Sourceval is_arr : t -> bool

check if input is of ndarray value; if input is of type DF/DR, check its primal' value

Sourceval row_num : t -> int

get the shape of primal' value of input; and then get the first dimension

Sourceval col_num : t -> int

get the shape of primal' value of input; and then get the second dimension

Sourceval numel : t -> int

for ndarray type input, return its total 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

if primal' value of input is ndarray, copy its value in a new AD type ndarray

Sourceval tile : t -> int array -> t

if primal' value of input is ndarray, apply the tile function

Sourceval repeat : t -> int array -> t

if primal' value of input is ndarray, apply the repeat function

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
Sourceval type_info : t -> string
Sourceval error_binop : string -> t -> t -> 'a
Sourceval error_uniop : string -> t -> 'a
OCaml

Innovation. Community. Security.