package owl-base

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

Module Owl_computation_engine.FlattenSource

Parameters

Signature

include module type of struct include Engine end
module Graph = Engine.Graph
Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

Execute actual computation included in each CGraph element (of output type float) in an array.

val eval_graph : Graph.graph -> unit

Execute actual computation of a computation graph.

include module type of struct include Graph end
module Optimiser = Graph.Optimiser
Type definition
type graph = Engine.Graph.graph
Core functions
val shape_or_value : Optimiser.Operator.Symbol.Shape.Type.t -> string

print shape for ndarrays, whilst value for scalars

val graph_to_dot : graph -> string

generate a string that can be written to a .dot file to draw the graph

val graph_to_trace : graph -> string

print the graph structure to a string

val save_graph : 'a -> string -> unit

save the graph object to a file with given name, using marshall format

val load_graph : string -> 'a * 'b

load the graph object from a file with given name

traverse each node in the input array, and return the random variable type nodes.

val invalidate_rvs : graph -> unit

TODO

Build a graph based on input nodes, output nodes, and graph name

get input nodes of a graph

get output nodes of a graph

val is_iopair_safe : 'a Owl_graph.node -> 'a Owl_graph.node -> bool

create an iopair between the input nodes and output nodes in a graph

val update_iopair : graph -> unit
val remove_unused_iopair : 'a Owl_graph.node array -> 'b array -> 'a Owl_graph.node array * 'b array

remove unuserd iopair from an array of nodes

initialize inputs nodes of a graph with given function f

val optimise : graph -> unit

optimise the graph structure

include module type of struct include Optimiser end
module Operator = Optimiser.Operator
Core functions
val estimate_complexity : 'a Owl_graph.node array -> int * int

TODO

val optimise_nodes : Operator.Symbol.Shape.Type.attr Owl_graph.node array -> unit

TODO

include module type of struct include Operator end
module Symbol = Operator.Symbol
Vectorised functions

noop arr performs no operation on the array arr and returns it as is. This can be useful as a placeholder function. Returns the input array arr.

val empty : int array -> Symbol.Shape.Type.arr

empty shape creates an uninitialized array with the specified shape. The contents of the array are undefined. Returns a new array with the given shape.

val zeros : int array -> Symbol.Shape.Type.arr

zeros shape creates an array with the specified shape, filled with zeros. Returns a new array with all elements initialized to zero.

val ones : int array -> Symbol.Shape.Type.arr

ones shape creates an array with the specified shape, filled with ones. Returns a new array with all elements initialized to one.

val create : int array -> Symbol.Shape.Type.elt -> Symbol.Shape.Type.arr

create shape value creates an array with the specified shape, filled with the given value. Returns a new array with all elements initialized to value.

val sequential : ?a:Symbol.Shape.Type.elt -> ?step:Symbol.Shape.Type.elt -> int array -> Symbol.Shape.Type.arr

sequential ?a ?step shape creates an array with the specified shape, filled with a sequence of values starting from a with a step of step. If a is not provided, the sequence starts from 0. If step is not provided, the step size is 1. Returns a new array with sequential values.

uniform ?a ?b shape creates an array with the specified shape, filled with random values drawn from a uniform distribution over [a, b\). If a and b are not provided, the default range is [0, 1\) . Returns a new array with uniform random values.

val gaussian : ?mu:Symbol.Shape.Type.elt -> ?sigma:Symbol.Shape.Type.elt -> int array -> Symbol.Shape.Type.arr

gaussian ?mu ?sigma shape creates an array with the specified shape, filled with random values drawn from a Gaussian distribution with mean mu and standard deviation sigma. If mu is not provided, the default mean is 0. If sigma is not provided, the default standard deviation is 1. Returns a new array with Gaussian random values.

val bernoulli : ?p:Symbol.Shape.Type.elt -> int array -> Symbol.Shape.Type.arr

bernoulli ?p shape creates an array with the specified shape, filled with random values drawn from a Bernoulli distribution with probability p of being 1. If p is not provided, the default probability is 0.5. Returns a new array with Bernoulli random values.

val init : int array -> (int -> Symbol.Shape.Type.elt) -> Symbol.Shape.Type.arr

init shape f creates an array with the specified shape, where each element is initialized using the function f. The function f takes the linear index of the element as input. Returns a new array with elements initialized by the function f.

val init_nd : int array -> (int array -> Symbol.Shape.Type.elt) -> Symbol.Shape.Type.arr

init_nd shape f creates an array with the specified shape, where each element is initialized using the function f. The function f takes the multidimensional index of the element as input. Returns a new array with elements initialized by the function f.

val shape : Symbol.Shape.Type.arr -> int array

shape arr returns the shape of the array arr as an array of integers, each representing the size of the corresponding dimension.

val numel : Symbol.Shape.Type.arr -> int

numel arr returns the total number of elements in the array arr.

get arr index retrieves the element at the specified multidimensional index in the array arr. Returns the value of the element at the given index.

val set : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.elt -> unit

set arr index value sets the element at the specified multidimensional index in the array arr to the given value.

val get_slice : int list list -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

get_slice slices arr extracts a slice from the array arr according to the list of slices. Each element in slices specifies the range for the corresponding dimension. Returns a new array with the extracted slice.

val set_slice : int list list -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> unit

set_slice slices src dest sets the slice in dest defined by slices with the values from the source array src.

get_fancy indices arr extracts elements from the array arr according to the list of indices. Each element in indices specifies an advanced indexing method. Returns a new array with the extracted elements.

set_fancy indices src dest sets the elements in dest defined by indices with the values from the source array src.

copy arr creates a deep copy of the array arr. Returns a new array that is a copy of arr.

val copy_ : out:'a -> 'b -> 'c

copy_ ~out src copies the contents of the array src into the pre-allocated array out.

val reset : Symbol.Shape.Type.arr -> unit

reset arr sets all elements of the array arr to zero.

val reshape : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

reshape arr shape reshapes the array arr into the new shape. The total number of elements must remain the same. Returns a new array with the specified shape.

reverse arr reverses the elements of the array arr along each dimension. Returns a new array with the elements reversed.

val tile : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

tile arr reps replicates the array arr according to the number of repetitions specified in reps for each dimension. Returns a new array with the tiled data.

val repeat : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

repeat arr reps repeats the elements of the array arr according to the number of repetitions specified in reps for each dimension. Returns a new array with the repeated data.

pad ?v padding arr pads the array arr with the value v according to the padding specification for each dimension. If v is not provided, the default padding value is zero. Returns a new array with the padded data.

val expand : ?hi:bool -> Symbol.Shape.Type.arr -> int -> Symbol.Shape.Type.arr

expand ?hi arr n expands the dimensions of the array arr by inserting a new dimension of size n. If hi is true, the new dimension is added at the beginning; otherwise, it is added at the end. Returns a new array with the expanded dimensions.

val squeeze : ?axis:int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

squeeze ?axis arr removes single-dimensional entries from the shape of the array arr. If axis is provided, only the specified dimensions are removed. Returns a new array with the squeezed shape.

val concatenate : ?axis:int -> Symbol.Shape.Type.arr array -> Symbol.Shape.Type.arr

concatenate ?axis arrays concatenates a sequence of arrays along the specified axis. If axis is not provided, the arrays are concatenated along the first axis. Returns a new array with the concatenated data.

val stack : ?axis:int -> Symbol.Shape.Type.arr array -> Symbol.Shape.Type.arr

stack ?axis arrays stacks a sequence of arrays along a new dimension at the specified axis. If axis is not provided, the arrays are stacked along the first axis. Returns a new array with the stacked data.

concat ~axis a b concatenates the arrays a and b along the specified axis. Returns a new array with the concatenated data.

val split : ?axis:int -> 'a -> 'b -> 'c

split ?axis src num_or_sections splits the array src into multiple sub-arrays along the specified axis.

  • num_or_sections specifies the number of equal-sized sub-arrays or the indices where to split. Returns an array of sub-arrays.
val draw : ?axis:int -> Symbol.Shape.Type.arr -> int -> Symbol.Shape.Type.arr * 'a array

draw ?axis arr n randomly draws n samples from the array arr along the specified axis. Returns a tuple containing the sampled array and an array of indices from which the samples were drawn.

map f arr applies the function f to each element of the array arr. Returns a new array with the results of applying f.

fold ?axis f init arr reduces the array arr along the specified axis using the function f and an initial value init. If axis is not provided, the reduction is performed on all elements. Returns a new array with the reduced values.

scan ?axis f arr performs a cumulative reduction of the array arr along the specified axis using the function f. Returns a new array with the cumulative results.

one_hot depth arr converts the array arr into a one-hot encoded array with a specified depth. Returns a new array with one-hot encoding.

delay f x returns f x. It allows to use a function that is not tracked by the computation graph and delay its evaluation. The output must have the same shape as the input.

delay_array out_shape f x works in the same way as delay but is applied on an array of ndarrays. Needs the shape of the output as an argument.

val lazy_print : ?max_row:int -> ?max_col:int -> ?header:bool -> ?fmt:(Symbol.Shape.Type.Device.A.elt -> string) -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

lazy_print x prints the output of x when it is evaluated. Is implemented as an identity node. For information about the optional parameters, refer to the print function of the Ndarray module.

val print : ?max_row:'a -> ?max_col:'b -> ?header:'c -> ?fmt:'d -> 'e -> unit

print ?max_row ?max_col ?header ?fmt data prints a representation of the given data.

  • max_row is an optional parameter specifying the maximum number of rows to print.
  • max_col is an optional parameter specifying the maximum number of columns to print.
  • header is an optional parameter to include a header in the output.
  • fmt is an optional parameter to specify the format of the output.

abs arr computes the absolute value of each element in the array arr. Returns a new array with the absolute values.

neg arr negates each element in the array arr. Returns a new array with each element negated.

floor arr applies the floor function to each element in the array arr. Returns a new array with the floor of each element.

ceil arr applies the ceiling function to each element in the array arr. Returns a new array with the ceiling of each element.

round arr rounds each element in the array arr to the nearest integer. Returns a new array with each element rounded to the nearest integer.

sqr arr computes the square of each element in the array arr. Returns a new array with the square of each element.

sqrt arr computes the square root of each element in the array arr. Returns a new array with the square roots of the elements.

log arr computes the natural logarithm of each element in the array arr. Returns a new array with the natural logarithms of the elements.

log2 arr computes the base-2 logarithm of each element in the array arr. Returns a new array with the base-2 logarithms of the elements.

log10 arr computes the base-10 logarithm of each element in the array arr. Returns a new array with the base-10 logarithms of the elements.

exp arr computes the exponential function of each element in the array arr. Returns a new array with the exponentials of the elements.

sin arr computes the sine of each element in the array arr. Returns a new array with the sines of the elements.

cos arr computes the cosine of each element in the array arr. Returns a new array with the cosines of the elements.

tan arr computes the tangent of each element in the array arr. Returns a new array with the tangents of the elements.

sinh arr computes the hyperbolic sine of each element in the array arr. Returns a new array with the hyperbolic sines of the elements.

cosh arr computes the hyperbolic cosine of each element in the array arr. Returns a new array with the hyperbolic cosines of the elements.

tanh arr computes the hyperbolic tangent of each element in the array arr. Returns a new array with the hyperbolic tangents of the elements.

asin arr computes the arcsine of each element in the array arr. Returns a new array with the arcsines of the elements.

acos arr computes the arccosine of each element in the array arr. Returns a new array with the arccosines of the elements.

atan arr computes the arctangent of each element in the array arr. Returns a new array with the arctangents of the elements.

asinh arr computes the inverse hyperbolic sine of each element in the array arr. Returns a new array with the inverse hyperbolic sines of the elements.

acosh arr computes the inverse hyperbolic cosine of each element in the array arr. Returns a new array with the inverse hyperbolic cosines of the elements.

atanh arr computes the inverse hyperbolic tangent of each element in the array arr. Returns a new array with the inverse hyperbolic tangents of the elements.

val min : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

min ?axis ?keep_dims arr computes the minimum value along the specified axis of the array arr.

  • axis specifies the axis along which to compute the minimum.
  • keep_dims specifies whether to keep the reduced dimensions. Returns a new array with the minimum values.
val max : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

max ?axis ?keep_dims arr computes the maximum value along the specified axis of the array arr.

  • axis specifies the axis along which to compute the maximum.
  • keep_dims specifies whether to keep the reduced dimensions. Returns a new array with the maximum values.
val sum : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

sum ?axis ?keep_dims arr computes the sum of elements along the specified axis of the array arr.

  • axis specifies the axis along which to compute the sum.
  • keep_dims specifies whether to keep the reduced dimensions. Returns a new array with the sum of elements.
val sum_reduce : ?axis:int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

sum_reduce ?axis arr computes the sum of elements along the specified axes of the array arr.

  • axis specifies the axes along which to compute the sum. Returns a new array with the sum of elements.

signum arr computes the signum function of each element in the array arr. Returns a new array where each element is -1, 0, or 1, depending on the sign of the corresponding element in arr.

sigmoid arr computes the sigmoid function of each element in the array arr. Returns a new array with the sigmoid values.

relu arr applies the Rectified Linear Unit (ReLU) function to each element in the array arr. Returns a new array where each element is the maximum of 0 and the corresponding element in arr.

dawsn arr computes Dawson's function of each element in the array arr. Returns a new array with Dawson's function values.

min' arr computes the minimum value in the array arr. Returns the minimum value as an element.

max' arr computes the maximum value in the array arr. Returns the maximum value as an element.

sum' arr computes the sum of all elements in the array arr. Returns the sum as an element.

log_sum_exp' arr computes the log-sum-exp of all elements in the array arr. Returns the log-sum-exp as an element.

val log_sum_exp : ?axis:int -> ?keep_dims:bool -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

log_sum_exp ?axis ?keep_dims arr computes the log of the sum of exponentials of elements along the specified axis of the array arr.

  • axis specifies the axis along which to compute the log-sum-exp. If not specified, computes over all elements.
  • keep_dims if true, retains reduced dimensions with size 1. Returns a new array with the log-sum-exp values.

l1norm' arr computes the L1 norm (sum of absolute values) of all elements in the array arr. Returns the L1 norm as an element.

l2norm' arr computes the L2 norm (Euclidean norm) of all elements in the array arr. Returns the L2 norm as an element.

l2norm_sqr' arr computes the squared L2 norm (sum of squared values) of all elements in the array arr. Returns the squared L2 norm as an element.

clip_by_value ?amin ?amax arr clips the values in the array arr to the range amin, amax.

  • amin specifies the minimum value to clip to.
  • amax specifies the maximum value to clip to. Returns a new array with the values clipped to the specified range.

clip_by_l2norm max_norm arr clips the values in the array arr so that the L2 norm does not exceed max_norm. Returns a new array with the values clipped by the specified L2 norm.

pow base exp computes each element of the array base raised to the power of the corresponding element in exp. Returns a new array with the power values.

scalar_pow scalar arr raises the scalar value scalar to the power of each element in the array arr. Returns a new array with the power values.

pow_scalar arr scalar raises each element in the array arr to the power of the scalar value scalar. Returns a new array with the power values.

atan2 y x computes the element-wise arctangent of y / x, using the signs of the elements to determine the correct quadrant. Returns a new array with the arctangent values.

scalar_atan2 scalar arr computes the element-wise arctangent of scalar / each element in the array arr. Returns a new array with the arctangent values.

atan2_scalar arr scalar computes the element-wise arctangent of each element in the array arr / scalar. Returns a new array with the arctangent values.

hypot x y computes the hypotenuse (sqrt(x^2 + y^2)) for each element in the arrays x and y. Returns a new array with the hypotenuse values.

min2 a b computes the element-wise minimum of arrays a and b. Returns a new array with the minimum values.

max2 a b computes the element-wise maximum of arrays a and b. Returns a new array with the maximum values.

add a b computes the element-wise addition of arrays a and b. Returns a new array with the sum of elements.

sub a b computes the element-wise subtraction of arrays a and b. Returns a new array with the difference of elements.

mul a b computes the element-wise multiplication of arrays a and b. Returns a new array with the product of elements.

div a b computes the element-wise division of arrays a and b. Returns a new array with the quotient of elements.

add_scalar arr scalar adds the scalar value scalar to each element in the array arr. Returns a new array with the resulting values.

sub_scalar arr scalar subtracts the scalar value scalar from each element in the array arr. Returns a new array with the resulting values.

mul_scalar arr scalar multiplies each element in the array arr by the scalar value scalar. Returns a new array with the resulting values.

div_scalar arr scalar divides each element in the array arr by the scalar value scalar. Returns a new array with the resulting values.

scalar_add scalar arr adds the scalar value scalar to each element in the array arr. Returns a new array with the resulting values.

scalar_sub scalar arr subtracts each element in the array arr from the scalar value scalar. Returns a new array with the resulting values.

scalar_mul scalar arr multiplies each element in the array arr by the scalar value scalar. Returns a new array with the resulting values.

scalar_div scalar arr divides the scalar value scalar by each element in the array arr. Returns a new array with the resulting values.

fma a b c computes the fused multiply-add operation, multiplying arrays a and b, then adding array c. Returns a new array with the resulting values.

elt_equal a b performs element-wise equality comparison between arrays a and b. Returns a new array where each element is true if the corresponding elements in a and b are equal, and false otherwise.

elt_not_equal a b performs element-wise inequality comparison between arrays a and b. Returns a new array where each element is true if the corresponding elements in a and b are not equal, and false otherwise.

elt_less a b performs element-wise less-than comparison between arrays a and b. Returns a new array where each element is true if the corresponding element in a is less than that in b, and false otherwise.

elt_greater a b performs element-wise greater-than comparison between arrays a and b. Returns a new array where each element is true if the corresponding element in a is greater than that in b, and false otherwise.

elt_less_equal a b performs element-wise less-than-or-equal-to comparison between arrays a and b. Returns a new array where each element is true if the corresponding element in a is less than or equal to that in b, and false otherwise.

elt_greater_equal a b performs element-wise greater-than-or-equal-to comparison between arrays a and b. Returns a new array where each element is true if the corresponding element in a is greater than or equal to that in b, and false otherwise.

elt_equal_scalar arr scalar performs element-wise equality comparison between each element in the array arr and the scalar value scalar. Returns a new array where each element is true if it equals scalar, and false otherwise.

elt_not_equal_scalar arr scalar performs element-wise inequality comparison between each element in the array arr and the scalar value scalar. Returns a new array where each element is true if it does not equal scalar, and false otherwise.

elt_less_scalar arr scalar performs element-wise less-than comparison between each element in the array arr and the scalar value scalar. Returns a new array where each element is true if it is less than scalar, and false otherwise.

elt_greater_scalar arr scalar performs element-wise greater-than comparison between each element in the array arr and the scalar value scalar. Returns a new array where each element is true if it is greater than scalar, and false otherwise.

elt_less_equal_scalar arr scalar performs element-wise less-than-or-equal-to comparison between each element in the array arr and the scalar value scalar. Returns a new array where each element is true if it is less than or equal to scalar, and false otherwise.

elt_greater_equal_scalar arr scalar performs element-wise greater-than-or-equal-to comparison between each element in the array arr and the scalar value scalar. Returns a new array where each element is true if it is greater than or equal to scalar, and false otherwise.

conv1d ?padding input kernel strides performs a 1-dimensional convolution on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length. Returns a new array with the result of the convolution.

conv2d ?padding input kernel strides performs a 2-dimensional convolution on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length. Returns a new array with the result of the convolution.

conv3d ?padding input kernel strides performs a 3-dimensional convolution on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length. Returns a new array with the result of the convolution.
val transpose_conv1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

transpose_conv1d ?padding input kernel strides performs a 1-dimensional transposed convolution (also known as deconvolution) on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length. Returns a new array with the result of the transposed convolution.
val transpose_conv2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

transpose_conv2d ?padding input kernel strides performs a 2-dimensional transposed convolution (also known as deconvolution) on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length. Returns a new array with the result of the transposed convolution.
val transpose_conv3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

transpose_conv3d ?padding input kernel strides performs a 3-dimensional transposed convolution (also known as deconvolution) on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length. Returns a new array with the result of the transposed convolution.
val dilated_conv1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

dilated_conv1d ?padding input kernel strides dilations performs a 1-dimensional dilated convolution on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length.
  • dilations specifies the dilation rate. Returns a new array with the result of the dilated convolution.
val dilated_conv2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

dilated_conv2d ?padding input kernel strides dilations performs a 2-dimensional dilated convolution on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length.
  • dilations specifies the dilation rate. Returns a new array with the result of the dilated convolution.
val dilated_conv3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

dilated_conv3d ?padding input kernel strides dilations performs a 3-dimensional dilated convolution on the input array using the specified kernel.

  • padding specifies the padding strategy (default is "valid").
  • strides specifies the stride length.
  • dilations specifies the dilation rate. Returns a new array with the result of the dilated convolution.
val max_pool1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

max_pool1d ?padding input pool_size strides applies a 1-dimensional max pooling operation on the input array.

  • padding specifies the padding strategy (default is "valid").
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length. Returns a new array with the result of the max pooling.
val max_pool2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

max_pool2d ?padding input pool_size strides applies a 2-dimensional max pooling operation on the input array.

  • padding specifies the padding strategy (default is "valid").
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length. Returns a new array with the result of the max pooling.
val max_pool3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

max_pool3d ?padding input pool_size strides applies a 3-dimensional max pooling operation on the input array.

  • padding specifies the padding strategy (default is "valid").
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length. Returns a new array with the result of the max pooling.
val avg_pool1d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

avg_pool1d ?padding input pool_size strides applies a 1-dimensional average pooling operation on the input array.

  • padding specifies the padding strategy (default is "valid").
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length. Returns a new array with the result of the average pooling.
val avg_pool2d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

avg_pool2d ?padding input pool_size strides applies a 2-dimensional average pooling operation on the input array.

  • padding specifies the padding strategy (default is "valid").
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length. Returns a new array with the result of the average pooling.
val avg_pool3d : ?padding:Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr

avg_pool3d ?padding input pool_size strides applies a 3-dimensional average pooling operation on the input array.

  • padding specifies the padding strategy (default is "valid").
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length. Returns a new array with the result of the average pooling.
val upsampling2d : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

upsampling2d input size performs a 2-dimensional upsampling on the input array.

  • size specifies the upsampling factors for each dimension. Returns a new array with the upsampled data.

conv1d_backward_input input kernel strides grad_output computes the gradient of the loss with respect to the 1-dimensional input array.

  • input is the original input array.
  • kernel is the convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the convolutional layer. Returns a new array with the gradients of the input.

conv1d_backward_kernel input kernel strides grad_output computes the gradient of the loss with respect to the 1-dimensional convolutional kernel.

  • input is the original input array.
  • kernel is the convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the convolutional layer. Returns a new array with the gradients of the kernel.

conv2d_backward_input input kernel strides grad_output computes the gradient of the loss with respect to the 2-dimensional input array.

  • input is the original input array.
  • kernel is the convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the convolutional layer. Returns a new array with the gradients of the input.

conv2d_backward_kernel input kernel strides grad_output computes the gradient of the loss with respect to the 2-dimensional convolutional kernel.

  • input is the original input array.
  • kernel is the convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the convolutional layer. Returns a new array with the gradients of the kernel.

conv3d_backward_input input kernel strides grad_output computes the gradient of the loss with respect to the 3-dimensional input array.

  • input is the original input array.
  • kernel is the convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the convolutional layer. Returns a new array with the gradients of the input.

conv3d_backward_kernel input kernel strides grad_output computes the gradient of the loss with respect to the 3-dimensional convolutional kernel.

  • input is the original input array.
  • kernel is the convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the convolutional layer. Returns a new array with the gradients of the kernel.
val transpose_conv1d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose_conv1d_backward_input input kernel strides grad_output computes the gradient of the loss with respect to the 1-dimensional input array for the transposed convolution operation.

  • input is the original input array.
  • kernel is the transposed convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the transposed convolutional layer. Returns a new array with the gradients of the input.
val transpose_conv1d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose_conv1d_backward_kernel input kernel strides grad_output computes the gradient of the loss with respect to the 1-dimensional transposed convolutional kernel.

  • input is the original input array.
  • kernel is the transposed convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the transposed convolutional layer. Returns a new array with the gradients of the kernel.
val transpose_conv2d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose_conv2d_backward_input input kernel strides grad_output computes the gradient of the loss with respect to the 2-dimensional input array for the transposed convolution operation.

  • input is the original input array.
  • kernel is the transposed convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the transposed convolutional layer. Returns a new array with the gradients of the input.
val transpose_conv2d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose_conv2d_backward_kernel input kernel strides grad_output computes the gradient of the loss with respect to the 2-dimensional transposed convolutional kernel.

  • input is the original input array.
  • kernel is the transposed convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the transposed convolutional layer. Returns a new array with the gradients of the kernel.
val transpose_conv3d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose_conv3d_backward_input input kernel strides grad_output computes the gradient of the loss with respect to the 3-dimensional input array for the transposed convolution operation.

  • input is the original input array.
  • kernel is the transposed convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the transposed convolutional layer. Returns a new array with the gradients of the input.
val transpose_conv3d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose_conv3d_backward_kernel input kernel strides grad_output computes the gradient of the loss with respect to the 3-dimensional transposed convolutional kernel.

  • input is the original input array.
  • kernel is the transposed convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the transposed convolutional layer. Returns a new array with the gradients of the kernel.
val dilated_conv1d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

dilated_conv1d_backward_input input kernel strides dilations grad_output computes the gradient of the loss with respect to the 1-dimensional input array for the dilated convolution operation.

  • input is the original input array.
  • kernel is the dilated convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • dilations specifies the dilation rate.
  • grad_output is the gradient of the loss with respect to the output of the dilated convolutional layer. Returns a new array with the gradients of the input.
val dilated_conv1d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

dilated_conv1d_backward_kernel input kernel strides dilations grad_output computes the gradient of the loss with respect to the 1-dimensional dilated convolutional kernel.

  • input is the original input array.
  • kernel is the dilated convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • dilations specifies the dilation rate.
  • grad_output is the gradient of the loss with respect to the output of the dilated convolutional layer. Returns a new array with the gradients of the kernel.
val dilated_conv2d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

dilated_conv2d_backward_input input kernel strides dilations grad_output computes the gradient of the loss with respect to the 2-dimensional input array for the dilated convolution operation.

  • input is the original input array.
  • kernel is the dilated convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • dilations specifies the dilation rate.
  • grad_output is the gradient of the loss with respect to the output of the dilated convolutional layer. Returns a new array with the gradients of the input.
val dilated_conv2d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

dilated_conv2d_backward_kernel input kernel strides dilations grad_output computes the gradient of the loss with respect to the 2-dimensional dilated convolutional kernel.

  • input is the original input array.
  • kernel is the dilated convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • dilations specifies the dilation rate.
  • grad_output is the gradient of the loss with respect to the output of the dilated convolutional layer. Returns a new array with the gradients of the kernel.
val dilated_conv3d_backward_input : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

dilated_conv3d_backward_input input kernel strides dilations grad_output computes the gradient of the loss with respect to the 3-dimensional input array for the dilated convolution operation.

  • input is the original input array.
  • kernel is the dilated convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • dilations specifies the dilation rate.
  • grad_output is the gradient of the loss with respect to the output of the dilated convolutional layer. Returns a new array with the gradients of the input.
val dilated_conv3d_backward_kernel : Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

dilated_conv3d_backward_kernel input kernel strides dilations grad_output computes the gradient of the loss with respect to the 3-dimensional dilated convolutional kernel.

  • input is the original input array.
  • kernel is the dilated convolutional kernel used during the forward pass.
  • strides specifies the stride length.
  • dilations specifies the dilation rate.
  • grad_output is the gradient of the loss with respect to the output of the dilated convolutional layer. Returns a new array with the gradients of the kernel.
val max_pool1d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

max_pool1d_backward padding input pool_size strides grad_output computes the gradient of the loss with respect to the 1-dimensional input array after max pooling.

  • padding specifies the padding strategy used during the forward pass.
  • input is the original input array.
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the max pooling layer. Returns a new array with the gradients of the input.
val max_pool2d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

max_pool2d_backward padding input pool_size strides grad_output computes the gradient of the loss with respect to the 2-dimensional input array after max pooling.

  • padding specifies the padding strategy used during the forward pass.
  • input is the original input array.
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the max pooling layer. Returns a new array with the gradients of the input.
val max_pool3d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

max_pool3d_backward padding input pool_size strides grad_output computes the gradient of the loss with respect to the 3-dimensional input array after max pooling.

  • padding specifies the padding strategy used during the forward pass.
  • input is the original input array.
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the max pooling layer. Returns a new array with the gradients of the input.
val avg_pool1d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

avg_pool1d_backward padding input pool_size strides grad_output computes the gradient of the loss with respect to the 1-dimensional input array after average pooling.

  • padding specifies the padding strategy used during the forward pass.
  • input is the original input array.
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the average pooling layer. Returns a new array with the gradients of the input.
val avg_pool2d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

avg_pool2d_backward padding input pool_size strides grad_output computes the gradient of the loss with respect to the 2-dimensional input array after average pooling.

  • padding specifies the padding strategy used during the forward pass.
  • input is the original input array.
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the average pooling layer. Returns a new array with the gradients of the input.
val avg_pool3d_backward : Owl_types.padding -> Symbol.Shape.Type.arr -> int array -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

avg_pool3d_backward padding input pool_size strides grad_output computes the gradient of the loss with respect to the 3-dimensional input array after average pooling.

  • padding specifies the padding strategy used during the forward pass.
  • input is the original input array.
  • pool_size specifies the size of the pooling window.
  • strides specifies the stride length.
  • grad_output is the gradient of the loss with respect to the output of the average pooling layer. Returns a new array with the gradients of the input.
val upsampling2d_backward : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

upsampling2d_backward input size grad_output computes the gradient of the loss with respect to the input array after 2-dimensional upsampling.

  • input is the original input array.
  • size specifies the upsampling factors for each dimension.
  • grad_output is the gradient of the loss with respect to the output of the upsampling layer. Returns a new array with the gradients of the input.
val row_num : Symbol.Shape.Type.arr -> int

row_num arr returns the number of rows in the array arr.

val col_num : Symbol.Shape.Type.arr -> int

col_num arr returns the number of columns in the array arr.

row arr idx extracts the row at index idx from the array arr. Returns a new array containing the specified row.

val rows : Symbol.Shape.Type.arr -> int array -> Symbol.Shape.Type.arr

rows arr indices extracts multiple rows specified by indices from the array arr. Returns a new array containing the selected rows.

val copy_row_to : Symbol.Shape.Type.arr -> 'a -> 'b -> unit

copy_row_to src src_idx dest_idx copies the row at index src_idx in the array src to the row at index dest_idx.

val copy_col_to : Symbol.Shape.Type.arr -> 'a -> 'b -> unit

copy_col_to src src_idx dest_idx copies the column at index src_idx in the array src to the column at index dest_idx.

diag ?k arr extracts the k-th diagonal from the array arr. If k is not provided, the main diagonal is extracted. Returns a new array containing the diagonal elements.

trace arr computes the sum of the elements on the main diagonal of the array arr. Returns the trace as an element.

dot a b computes the dot product of the arrays a and b. Returns a new array with the result of the dot product.

val transpose : ?axis:int array -> Symbol.Shape.Type.arr -> Symbol.Shape.Type.arr

transpose ?axis arr transposes the array arr. If axis is provided, the transpose is performed according to the specified axes. Returns a new array with the transposed data.

val to_rows : Symbol.Shape.Type.arr -> 'a array

to_rows arr converts the array arr into an array of row vectors. Returns an array where each element is a row from the original array.

of_rows rows creates an array by stacking the row vectors in rows. Returns a new array constructed from the row vectors.

val to_cols : Symbol.Shape.Type.arr -> 'a array

to_cols arr converts the array arr into an array of column vectors. Returns an array where each element is a column from the original array.

of_cols cols creates an array by stacking the column vectors in cols. Returns a new array constructed from the column vectors.

val of_array : Symbol.Shape.Type.elt array -> int array -> Symbol.Shape.Type.arr

of_array data shape creates an array from a flat array data with the specified shape. Returns a new array with the data arranged according to the shape.

val of_arrays : Symbol.Shape.Type.elt array array -> Symbol.Shape.Type.arr

of_arrays data creates an array from a 2D array data, where each sub-array represents a row. Returns a new array with the data from the 2D array.

val to_arrays : Symbol.Shape.Type.arr -> Symbol.Shape.Type.elt array array

to_arrays arr converts the array arr into a 2D array where each sub-array represents a row. Returns a 2D array with the data from the original array.

Scalar functions
module Scalar = Operator.Scalar
module Mat = Operator.Mat
module Linalg = Operator.Linalg
include module type of struct include Symbol end
module Shape = Symbol.Shape
Core functions
val op_to_str : Shape.Type.op -> string

return the name of the operator as string

val is_random_variable : Shape.Type.op -> bool

check if operator is randon variable

val refnum : 'a Owl_graph.node -> int

return the reference number of the given node

val node_shape : Shape.Type.attr Owl_graph.node -> int array

return the shape of a node

val node_numel : Shape.Type.attr Owl_graph.node -> int

return the number of elements of a node

val is_shape_unknown : Shape.Type.attr Owl_graph.node -> bool

check if the shape of the input node is unknown

val infer_shape_graph : Shape.Type.attr Owl_graph.node array -> unit

automatically infer the shape of input node according to its descendents' shapes

val shape_to_str : int array option array -> string

helper function; return the input array in string format.

val node_to_str : Shape.Type.attr Owl_graph.node -> string

print node's information to string

val node_to_arr : Shape.Type.t -> Shape.Type.arr

Wrap computation graph node in an array type

val arr_to_node : Shape.Type.arr -> Shape.Type.t

Unwrap the array type to get the computation graph node within

val node_to_elt : Shape.Type.t -> Shape.Type.elt

Wrap computation graph node in an Elt type

val elt_to_node : Shape.Type.elt -> Shape.Type.t

Unwrap the Elt type to get the computation graph node within

val make_node : ?name:string -> ?value:Shape.Type.Device.value array -> ?shape:int array option array -> ?freeze:bool -> ?reuse:bool -> ?state:Shape.Type.state -> Shape.Type.op -> Shape.Type.attr Owl_graph.node

crate a computation graph node

val make_then_connect : ?shape:int array option array -> Shape.Type.op -> Shape.Type.attr Owl_graph.node array -> Shape.Type.attr Owl_graph.node

make nodes and then connect parents and children

val var_arr : ?shape:int array -> string -> Shape.Type.arr

creat a node and wrap in Arr type

val var_elt : string -> Shape.Type.elt

creat a node and wrap in Elt type

val const_arr : string -> Shape.Type.Device.A.arr -> Shape.Type.arr

get ndarray value from input and create an node and wrap in Arr type

val const_elt : string -> Shape.Type.Device.A.elt -> Shape.Type.elt

get value from input and create an node and wrap in Elt type

val new_block_id : unit -> int

new_block_id () returns an unused block id.

val make_empty_block : ?block_id:int -> int -> Shape.Type.block

make_empty_block s returns an empty block of memory of size s.

val make_value_block : Shape.Type.Device.value -> Shape.Type.attr Owl_graph.node -> unit

make_value_block value node creates a block of memory initialised with value and links the new block to node.

get_block node returns the memory block allocated to node. If no block is allocated, throws an exception.

val add_node_to_block : Shape.Type.attr Owl_graph.node -> Shape.Type.block -> unit

Link a node to a reusable block and initialises its memory on the memory of the block.

val get_active_node : Shape.Type.block -> Shape.Type.attr Owl_graph.node option

Return the node that is currently using the memory of the block.

val set_active_node : Shape.Type.block -> Shape.Type.attr Owl_graph.node -> unit

Update the node that is currently using the block of memory.

val get_block_id : Shape.Type.attr Owl_graph.node -> int

get_block_id node returns the id of the block assigned to node. If node has not been assigned yet, returns -1.

val set_value : Shape.Type.attr Owl_graph.node -> Shape.Type.Device.value array -> unit

set the arrays of value to cgraph node

get the arrays of value of cgraph node

val set_operator : Shape.Type.attr Owl_graph.node -> Shape.Type.op -> unit

set the operator of cgraph node

get the operator of cgraph node

val set_reuse : Shape.Type.attr Owl_graph.node -> bool -> unit

set reuse attribute in a node

val get_reuse : Shape.Type.attr Owl_graph.node -> bool

get reuse attribute in a node

val is_shared : Shape.Type.attr Owl_graph.node -> bool

check of the data block of memory is shared in a node

get_shared_nodes node returns the nodes sharing the same block of memory as node.

val is_var : Shape.Type.attr Owl_graph.node -> bool

check if the node's operator is Var type

val is_const : Shape.Type.attr Owl_graph.node -> bool

check if the node's operator is Const type

val is_node_arr : Shape.Type.attr Owl_graph.node -> bool

check the shape of a node's attr and return if it indicates an ndarray

val is_node_elt : Shape.Type.attr Owl_graph.node -> bool

check the shape of a node's attr and return if it indicates an elt

val is_assigned : Shape.Type.attr Owl_graph.node -> bool

is_assigned node checks if a block of memory has been assigned to node.

val check_assigned : Shape.Type.attr Owl_graph.node -> unit

check_assigned node throws an exception if node has not been assigned to a block.

val is_valid : Shape.Type.attr Owl_graph.node -> bool

check if the state attribute of a node is Valid

val validate : Shape.Type.attr Owl_graph.node -> unit

set Valid to the state attribute of a node

val invalidate : Shape.Type.attr Owl_graph.node -> unit

set Invalid to the state attribute of a node

val invalidate_graph : Shape.Type.attr Owl_graph.node -> unit

iteratively invalidate the nodes in a graph

val is_freeze : Shape.Type.attr Owl_graph.node -> bool

check the freeze attribute of a node

val freeze : Shape.Type.attr Owl_graph.node -> unit

return the freeze attribute of a node

val freeze_descendants : Shape.Type.attr Owl_graph.node array -> unit

iteratively freeze the descendants of a node

val freeze_ancestors : Shape.Type.attr Owl_graph.node array -> unit

iteratively freeze the ancestors of a node

pack an A.arr type input into Arr type

unpack input into A.arr type

pack an A.elt type input into Elt type

unpack input into A.elt type

val unsafe_assign_arr : Shape.Type.arr -> Shape.Type.Device.A.arr -> unit

assign Arr type value

val assign_arr : Shape.Type.arr -> Shape.Type.Device.A.arr -> unit

assign Arr type value

val assign_elt : Shape.Type.elt -> Shape.Type.Device.A.elt -> unit

assign Elt type value

val float_to_elt : float -> Shape.Type.elt

build an Elt type based on float value

val elt_to_float : Shape.Type.elt -> float

retrive a float value from an Elt type value

include module type of struct include Shape end
module Type = Shape.Type
Core functions
val infer_shape : Type.op -> Type.attr Owl_graph.node array -> int array option array

TODO

include module type of struct include Type end
module Device = Type.Device
Type definition
type state = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.state =
  1. | Valid
  2. | Invalid
    (*

    TODO

    *)

TODO

and block = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.block = {
  1. size : int;
  2. block_id : int;
  3. mutable active : t option;
  4. mutable memory : Device.value;
  5. mutable nodes : t list;
}

block type keeps a reference to a block of memory and to the nodes sharing that block.

and attr = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.attr = {
  1. mutable op : op;
  2. mutable freeze : bool;
  3. mutable reuse : bool;
  4. mutable state : state;
  5. mutable shape : int array option array;
  6. mutable value : Device.value array;
  7. mutable block : block array option;
}

TODO

and op = Engine.Graph.Optimiser.Operator.Symbol.Shape.Type.op =
  1. | Noop
  2. | Var
  3. | Const
  4. | Empty of int array
  5. | Zeros of int array
  6. | Ones of int array
  7. | Create of int array
  8. | Sequential of int array
  9. | Uniform of int array
  10. | Gaussian of int array
  11. | Bernoulli of int array
  12. | Init of int array * int -> elt
  13. | Get of int array
  14. | Set of int array
  15. | GetSlice of int list list
  16. | SetSlice of int list list
  17. | GetFancy of Owl_types_common.index list
  18. | SetFancy of Owl_types_common.index list
  19. | Copy
  20. | Reset
  21. | Reshape of int array
  22. | Reverse
  23. | Tile of int array
  24. | Repeat of int array
  25. | Pad of elt * int list list
  26. | Concatenate of int
  27. | Stack of int
  28. | Split of int * int array
  29. | Draw of int * int
  30. | Map of elt -> elt
  31. | Fold of int * elt -> elt -> elt
  32. | Scan of int * elt -> elt -> elt
  33. | OneHot of int
  34. | OfArray of int array
  35. | Delay of Device.A.arr -> Device.A.arr
  36. | DelayArray of int array * Device.A.arr array -> Device.A.arr
  37. | LazyPrint of int option * int option * bool option * (Device.A.elt -> string) option
  38. | Abs
  39. | Neg
  40. | Floor
  41. | Ceil
  42. | Round
  43. | Sqr
  44. | Sqrt
  45. | Log
  46. | Log2
  47. | Log10
  48. | Exp
  49. | Sin
  50. | Cos
  51. | Tan
  52. | Sinh
  53. | Cosh
  54. | Tanh
  55. | Asin
  56. | Acos
  57. | Atan
  58. | Asinh
  59. | Acosh
  60. | Atanh
  61. | Min of bool * int
  62. | Max of bool * int
  63. | Sum of bool * int
  64. | SumReduce of int array
  65. | Signum
  66. | Sigmoid
  67. | Relu
  68. | Dawsn
  69. | Min'
  70. | Max'
  71. | Sum'
  72. | LogSumExp'
  73. | LogSumExp of bool * int
  74. | L1norm'
  75. | L2norm'
  76. | L2NormSqr'
  77. | ClipByValue
  78. | ClipByL2norm
  79. | Pow
  80. | ScalarPow
  81. | PowScalar
  82. | Atan2
  83. | ScalarAtan2
  84. | Atan2Scalar
  85. | Hypot
  86. | Min2
  87. | Max2
  88. | Add
  89. | Sub
  90. | Mul
  91. | Div
  92. | AddScalar
  93. | SubScalar
  94. | MulScalar
  95. | DivScalar
  96. | ScalarAdd
  97. | ScalarSub
  98. | ScalarMul
  99. | ScalarDiv
  100. | FMA
  101. | EltEqual
  102. | EltNotEqual
  103. | EltLess
  104. | EltGreater
  105. | EltLessEqual
  106. | EltGreaterEqual
  107. | EltEqualScalar
  108. | EltNotEqualScalar
  109. | EltLessScalar
  110. | EltGreaterScalar
  111. | EltLessEqualScalar
  112. | EltGreaterEqualScalar
  113. | Conv1d of Owl_types_common.padding * int array
  114. | Conv2d of Owl_types_common.padding * int array
  115. | Conv3d of Owl_types_common.padding * int array
  116. | TransposeConv1d of Owl_types_common.padding * int array
  117. | TransposeConv2d of Owl_types_common.padding * int array
  118. | TransposeConv3d of Owl_types_common.padding * int array
  119. | DilatedConv1d of Owl_types_common.padding * int array * int array
  120. | DilatedConv2d of Owl_types_common.padding * int array * int array
  121. | DilatedConv3d of Owl_types_common.padding * int array * int array
  122. | MaxPool1d of Owl_types_common.padding * int array * int array
  123. | MaxPool2d of Owl_types_common.padding * int array * int array
  124. | MaxPool3d of Owl_types_common.padding * int array * int array
  125. | AvgPool1d of Owl_types_common.padding * int array * int array
  126. | AvgPool2d of Owl_types_common.padding * int array * int array
  127. | AvgPool3d of Owl_types_common.padding * int array * int array
  128. | UpSampling2d of int array
  129. | Conv1dBackwardInput of int array
  130. | Conv1dBackwardKernel of int array
  131. | Conv2dBackwardInput of int array
  132. | Conv2dBackwardKernel of int array
  133. | Conv3dBackwardInput of int array
  134. | Conv3dBackwardKernel of int array
  135. | TransposeConv1dBackwardInput of int array
  136. | TransposeConv1dBackwardKernel of int array
  137. | TransposeConv2dBackwardInput of int array
  138. | TransposeConv2dBackwardKernel of int array
  139. | TransposeConv3dBackwardInput of int array
  140. | TransposeConv3dBackwardKernel of int array
  141. | DilatedConv1dBackwardInput of int array * int array
  142. | DilatedConv1dBackwardKernel of int array * int array
  143. | DilatedConv2dBackwardInput of int array * int array
  144. | DilatedConv2dBackwardKernel of int array * int array
  145. | DilatedConv3dBackwardInput of int array * int array
  146. | DilatedConv3dBackwardKernel of int array * int array
  147. | MaxPool1dBackward of Owl_types_common.padding * int array * int array
  148. | MaxPool2dBackward of Owl_types_common.padding * int array * int array
  149. | MaxPool3dBackward of Owl_types_common.padding * int array * int array
  150. | AvgPool1dBackward of Owl_types_common.padding * int array * int array
  151. | AvgPool2dBackward of Owl_types_common.padding * int array * int array
  152. | AvgPool3dBackward of Owl_types_common.padding * int array * int array
  153. | UpSampling2dBackward of int array
  154. | RowNum
  155. | ColNum
  156. | Row
  157. | Rows of int array
  158. | CopyRowTo
  159. | CopyColTo
  160. | Dot of bool * bool * elt * elt
  161. | Inv
  162. | Trace
  163. | Transpose of int array
  164. | ToRows
  165. | OfRows
  166. | Scalar_Add
  167. | Scalar_Sub
  168. | Scalar_Mul
  169. | Scalar_Div
  170. | Scalar_Pow
  171. | Scalar_Atan2
  172. | Scalar_Abs
  173. | Scalar_Neg
  174. | Scalar_Sqr
  175. | Scalar_Sqrt
  176. | Scalar_Exp
  177. | Scalar_Log
  178. | Scalar_Log2
  179. | Scalar_Log10
  180. | Scalar_Signum
  181. | Scalar_Floor
  182. | Scalar_Ceil
  183. | Scalar_Round
  184. | Scalar_Sin
  185. | Scalar_Cos
  186. | Scalar_Tan
  187. | Scalar_Sinh
  188. | Scalar_Cosh
  189. | Scalar_Tanh
  190. | Scalar_Asin
  191. | Scalar_Acos
  192. | Scalar_Atan
  193. | Scalar_Asinh
  194. | Scalar_Acosh
  195. | Scalar_Atanh
  196. | Scalar_Relu
  197. | Scalar_Dawsn
  198. | Scalar_Sigmoid
  199. | Fused_Adagrad of float * float
    (*

    TODO

    *)
include module type of struct include Device end
module A = Device.A
Type definition
Core functions
val make_device : unit -> device
val arr_to_value : A.arr -> value
val value_to_arr : value -> A.arr
val elt_to_value : A.elt -> value
val value_to_elt : value -> A.elt
val value_to_float : value -> float
val is_arr : value -> bool
val is_elt : value -> bool