package arrayjit

  1. Overview
  2. Docs

Operation types shared by all backends; and precision types.

module Lazy = Utils.Lazy

*** Precision ***

type float16_elt = Bigarray.float32_elt
type float32_elt = Bigarray.float32_elt
type float64_elt = Bigarray.float64_elt
type ('ocaml, 'impl) precision =
  1. | Byte : (Base.char, uint8_elt) precision
  2. | Half : (Base.float, float16_elt) precision
  3. | Single : (Base.float, float32_elt) precision
  4. | Double : (Base.float, float64_elt) precision
val sexp_of_precision : 'ocaml 'impl. ('ocaml -> Sexplib0.Sexp.t) -> ('impl -> Sexplib0.Sexp.t) -> ('ocaml, 'impl) precision -> Sexplib0.Sexp.t
type prec =
  1. | Void_prec
  2. | Byte_prec of (Base.char, uint8_elt) precision
  3. | Half_prec of (Base.float, float16_elt) precision
  4. | Single_prec of (Base.float, float32_elt) precision
  5. | Double_prec of (Base.float, float64_elt) precision
val byte : prec
val half : prec
val single : prec
val double : prec
val sexp_of_prec : prec -> Base.Sexp.t
val prec_of_sexp : Base.Sexp.t -> prec
val precision_to_string : ('ocaml, 'elt_t) precision -> string
val prec_string : prec -> string
val equal_prec : prec -> prec -> bool
val prec_in_bytes : prec -> int
val promote_prec : prec -> prec -> prec
val is_double : ('ocaml, 'elt_t) precision -> bool
val is_double_prec : prec -> bool
val pack_prec : ('ocaml, 'elt_t) precision -> prec
type 'r map_prec = {
  1. f : 'ocaml 'elt_t. ('ocaml, 'elt_t) precision -> 'r;
}
val map_prec : ?default:'a -> 'a map_prec -> prec -> 'a
val c_typ_of_prec : prec -> Gccjit.Type.type_kind

*** Operations ***

type init_op =
  1. | Constant_fill of {
    1. values : Base.float Base.array;
    2. strict : Base.bool;
    }
    (*

    Fills in the numbers where the rightmost axis is contiguous. If strict=true, loops over the provided values.

    *)
  2. | Range_over_offsets
    (*

    Fills in the offset number of each cell (i.e. how many cells away it is from the beginning).

    *)
  3. | Standard_uniform
    (*

    Draws the values from U(0,1).

    *)
  4. | File_mapped of Base.string * prec
    (*

    Reads the data using Unix.openfile and Unix.map_file.

    *)

Initializes or resets a array by filling in the corresponding numbers, at the appropriate precision.

val equal_init_op : init_op -> init_op -> Base.bool
val init_op_of_sexp : Sexplib0.Sexp.t -> init_op
val sexp_of_init_op : init_op -> Sexplib0.Sexp.t
type binop =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div
  5. | ToPowOf
  6. | Relu_gate
  7. | Arg2
  8. | Arg1
val binop_of_sexp : Sexplib0.Sexp.t -> binop
val sexp_of_binop : binop -> Sexplib0.Sexp.t
val compare_binop : binop -> binop -> Base.int
val equal_binop : binop -> binop -> Base.bool
type unop =
  1. | Identity
  2. | Relu
val unop_of_sexp : Sexplib0.Sexp.t -> unop
val sexp_of_unop : unop -> Sexplib0.Sexp.t
val compare_unop : unop -> unop -> Base.int
val equal_unop : unop -> unop -> Base.bool
val neutral_elem : binop -> float

Either the left-neutral or right-neutral element of the operation. Unspecified if the operation does not have a neutral element.

val interpret_binop : binop -> Base.Float.t -> Base.Float.t -> Base.Float.t
val interpret_unop : unop -> Base.Float.t -> Base.Float.t
val binop_C_syntax : is_double:bool -> binop -> string * string * string
val binop_cd_syntax : binop -> string
val assign_op_C_syntax : binop -> string
val assign_op_cd_syntax : initialize_neutral:bool -> binop -> string
val unop_cd_syntax : unop -> string

*** Global references ***

type voidptr = Base.unit Ctypes.ptr
val sexp_of_voidptr : unit Ctypes_static.ptr -> Base.Sexp.t
val compare_voidptr : 'a Ctypes.ptr -> 'a Ctypes.ptr -> int
val equal_voidptr : voidptr -> voidptr -> Base.bool
val ptr_to_string : 'a Ctypes.ptr -> prec -> string
type global_identifier =
  1. | C_function of Base.string
    (*

    Calls a no-argument or indices-arguments C function.

    *)
  2. | External_unsafe of {
    1. ptr : voidptr;
    2. prec : prec;
    3. dims : Base.int Base.array Lazy.t;
    }
val sexp_of_global_identifier : global_identifier -> Sexplib0.Sexp.t
val equal_global_identifier : global_identifier -> global_identifier -> Base.bool
val compare_global_identifier : global_identifier -> global_identifier -> Base.int
OCaml

Innovation. Community. Security.