Neural.Neuron Functor

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

Github: {Signature} {Implementation}

Init neuron

type typ =
  | Uniform of float * float
  | Gaussian of float * float
  | Standard
  | Tanh
  | GlorotNormal
  | GlorotUniform
  | LecunNormal
  | Custom of (int array -> t)

Initialisation types

val calc_fans : int array -> float * float

Calculate fan-in and fan-out of weights.

source code

val run : typ -> int array -> t -> t

Execute the computation in this neuron.

val to_string : typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Input neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : int array -> neuron_typ

Create the neuron.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Activation neuron

type typ =
  | Elu
  | Relu
  | Sigmoid
  | HardSigmoid
  | Softmax
  | Softplus
  | Softsign
  | Tanh
  | Relu6
  | LeakyRelu of float
  | TRelu of float
  | Custom of (t -> t)
  | None

Types of activation functions.

type neuron_typ = {
  mutable activation : typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Linear neuron

type neuron_typ = {
  mutable w : t;
  mutable b : t;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int -> int -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

LinearNoBias neuron

type neuron_typ = {
  mutable w : t;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int -> int -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Recurrent neuron

type neuron_typ = {
  mutable whh : t;
  mutable wxh : t;
  mutable why : t;
  mutable bh : t;
  mutable by : t;
  mutable h : t;
  mutable hiddens : int;
  mutable act : Activation.typ;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?time_steps:int -> ?inputs:int -> int -> int -> Activation.typ -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

LSTM neuron

type neuron_typ = {
  mutable wxi : t;
  mutable whi : t;
  mutable wxc : t;
  mutable whc : t;
  mutable wxf : t;
  mutable whf : t;
  mutable wxo : t;
  mutable who : t;
  mutable bi : t;
  mutable bc : t;
  mutable bf : t;
  mutable bo : t;
  mutable c : t;
  mutable h : t;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?time_steps:int -> ?inputs:int -> int -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GRU neuron

type neuron_typ = {
  mutable wxz : t;
  mutable whz : t;
  mutable wxr : t;
  mutable whr : t;
  mutable wxh : t;
  mutable whh : t;
  mutable bz : t;
  mutable br : t;
  mutable bh : t;
  mutable h : t;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?time_steps:int -> ?inputs:int -> int -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Conv1D neuron

type neuron_typ = {
  mutable w : t;
  mutable b : t;
  mutable kernel : int array;
  mutable stride : int array;
  mutable padding : Owl_types.padding;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int array -> Owl_types.padding -> int array -> int array -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Conv2D neuron

type neuron_typ = {
  mutable w : t;
  mutable b : t;
  mutable kernel : int array;
  mutable stride : int array;
  mutable padding : Owl_types.padding;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int array -> Owl_types.padding -> int array -> int array -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Conv3D neuron

type neuron_typ = {
  mutable w : t;
  mutable b : t;
  mutable kernel : int array;
  mutable stride : int array;
  mutable padding : Owl_types.padding;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int array -> Owl_types.padding -> int array -> int array -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

FullyConnected neuron

type neuron_typ = {
  mutable w : t;
  mutable b : t;
  mutable init_typ : Init.typ;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int -> int -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

MaxPool1D neuron

type neuron_typ = {
  mutable padding : Owl_types.padding;
  mutable kernel : int array;
  mutable stride : int array;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : Owl_types.padding -> int array -> int array -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

MaxPool2D neuron

type neuron_typ = {
  mutable padding : Owl_types.padding;
  mutable kernel : int array;
  mutable stride : int array;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

AvgPool1D neuron

type neuron_typ = {
  mutable padding : Owl_types.padding;
  mutable kernel : int array;
  mutable stride : int array;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

AvgPool2D neuron

type neuron_typ = {
  mutable padding : Owl_types.padding;
  mutable kernel : int array;
  mutable stride : int array;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : Owl_types.padding -> int array -> int array -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GlobalMaxPool1D neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GlobalMaxPool2D neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GlobalAvgPool1D neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GlobalAvgPool2D neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

UpSampling1D neuron

UpSampling2D neuron

UpSampling3D neuron

Padding1D neuron

Padding2D neuron

Padding3D neuron

Lambda neuron

type neuron_typ = {
  mutable lambda : t -> t;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : (t -> t) -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Dropout neuron

type neuron_typ = {
  mutable rate : float;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : float -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Reshape neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int array -> int array -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Flatten neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Add neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t array -> 'a -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Mul neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t array -> 'a -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Dot neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t array -> 'a -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Max neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t array -> 'a -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Average neuron

type neuron_typ = {
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : unit -> neuron_typ

Create the neuron.

val connect : int array array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : 'a -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t array -> 'a -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Concatenate neuron

type neuron_typ = {
  mutable axis : int;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : int -> neuron_typ

Create the neuron.

val connect : int array array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t array -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Normalisation neuron

type neuron_typ = {
  mutable axis : int;
  mutable beta : t;
  mutable gamma : t;
  mutable mu : t;
  mutable var : t;
  mutable decay : t;
  mutable training : bool;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?training:bool -> ?decay:float -> ?mu:arr -> ?var:arr -> int -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GaussianNoise neuron

type neuron_typ = {
  mutable sigma : float;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : float -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

GaussianDropout neuron

type neuron_typ = {
  mutable rate : float;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : float -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

AlphaDropout neuron

type neuron_typ = {
  mutable rate : float;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : float -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Embedding neuron

type neuron_typ = {
  mutable w : t;
  mutable init_typ : Init.typ;
  mutable in_dim : int;
  mutable in_shape : int array;
  mutable out_shape : int array;
  }

Neuron type definition.

val create : ?inputs:int -> int -> int -> Init.typ -> neuron_typ

Create the neuron.

val connect : int array -> neuron_typ -> unit

Connect this neuron to others in a neural network.

val init : neuron_typ -> unit

Initialise the neuron and its parameters.

val reset : neuron_typ -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron_typ -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron_typ -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron_typ -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron_typ -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron_typ -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron_typ -> neuron_typ

Make a deep copy of the neuron and its parameters.

val run : t -> neuron_typ -> t

Execute the computation in this neuron.

val to_string : neuron_typ -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : unit -> string

Return the name of the neuron.

Masking neuron

Core functions

type neuron =
  Input of Input.neuron_typ
  | Linear of Linear.neuron_typ
  | LinearNoBias of LinearNoBias.neuron_typ
  | Embedding of Embedding.neuron_typ
  | LSTM of LSTM.neuron_typ
  | GRU of GRU.neuron_typ
  | Recurrent of Recurrent.neuron_typ
  | Conv1D of Conv1D.neuron_typ
  | Conv2D of Conv2D.neuron_typ
  | Conv3D of Conv3D.neuron_typ
  | FullyConnected of FullyConnected.neuron_typ
  | MaxPool1D of MaxPool1D.neuron_typ
  | MaxPool2D of MaxPool2D.neuron_typ
  | AvgPool1D of AvgPool1D.neuron_typ
  | AvgPool2D of AvgPool2D.neuron_typ
  | GlobalMaxPool1D of GlobalMaxPool1D.neuron_typ
  | GlobalMaxPool2D of GlobalMaxPool2D.neuron_typ
  | GlobalAvgPool1D of GlobalAvgPool1D.neuron_typ
  | GlobalAvgPool2D of GlobalAvgPool2D.neuron_typ
  | Dropout of Dropout.neuron_typ
  | Reshape of Reshape.neuron_typ
  | Flatten of Flatten.neuron_typ
  | Lambda of Lambda.neuron_typ
  | Activation of Activation.neuron_typ
  | GaussianNoise of GaussianNoise.neuron_typ
  | GaussianDropout of GaussianDropout.neuron_typ
  | AlphaDropout of AlphaDropout.neuron_typ
  | Normalisation of Normalisation.neuron_typ
  | Add of Add.neuron_typ
  | Mul of Mul.neuron_typ
  | Dot of Dot.neuron_typ
  | Max of Max.neuron_typ
  | Average of Average.neuron_typ
  | Concatenate of Concatenate.neuron_typ

Types of neuron.

val get_in_out_shape : neuron -> int array * int array

Get both input and output shapes of a neuron.

source code

val get_in_shape : neuron -> int array

Get the input shape of a neuron.

source code

val get_out_shape : neuron -> int array

Get the output shape of a neuron.

source code

val connect : int array array -> neuron -> unit

Connect this neuron to others in a neural network.

val init : neuron -> unit

Initialise the neuron and its parameters.

val reset : neuron -> unit

Reset the parameters in a neuron.

val mktag : int -> neuron -> unit

Tag the neuron, used by Algodiff module.

val mkpar : neuron -> t array

Assemble all the parameters in an array, used by Optimise module.

val mkpri : neuron -> t array

Assemble all the primial values in an array, used by Optimise module.

val mkadj : neuron -> t array

Assemble all the adjacent values in an array, used by Optimise module.

val update : neuron -> t array -> unit

Update parameters in a neuron, used by Optimise module.

val copy : neuron -> neuron

Make a deep copy of the neuron and its parameters.

val run : t array -> neuron -> t

Execute the computation in this neuron.

val to_string : neuron -> string

Convert the neuron to its string representation. The string is often a summary of the parameters defined in the neuron.

val to_name : neuron -> string

Return the name of the neuron.