Matrix module: including creation, manipulation, and various vectorised mathematical operations.
About the comparison of two complex numbers x and y, Owl uses the following conventions: 1) x and y are equal iff both real and imaginary parts are equal; 2) x is less than y if the magnitude of x is less than the magnitude of x; in case both x and y have the same magnitudes, x is less than x if the phase of x is less than the phase of y; 3) less or equal, greater, greater or equal relation can be further defined atop of the aforementioned conventions.
The generic module supports operations for the following Bigarry element types: Int8_signed, Int8_unsigned, Int16_signed, Int16_unsigned, Int32, Int64, Float32, Float64, Complex32, Complex64.
init m n f creates a matrix x of shape m x n, then using f to initialise the elements in x. The input of f is 1-dimensional index of the matrix. You need to explicitly convert it if you need 2D index. The function Owl_utils.ind can help you.
init_2d m n f s almost the same as init but f receives 2D index as input. It is more convenient since you don't have to convert the index by yourself, but this also means init_2d is slower than init.
complex re im constructs a complex ndarray/matrix from re and im. re and im contain the real and imaginary part of x respectively.
Note that both re and im can be complex but must have same type. The real part of re will be the real part of x and the imaginary part of im will be the imaginary part of x.
complex rho theta constructs a complex ndarray/matrix from polar coordinates rho and theta. rho contains the magnitudes and theta contains phase angles. Note that the behaviour is undefined if rho has negative elelments or theta has infinity elelments.
uniform m n creates an m by n matrix where all the elements follow a uniform distribution in (0,1) interval. uniform ~scale:a m n adjusts the interval to (0,a).
linspace a b n linearly divides the interval [a,b] into n pieces by creating an m by 1 row vector. E.g., linspace 0. 5. 6 will create a row vector [0;1;2;3;4;5].
meshgrid a1 b1 a2 b2 n1 n2 is similar to the meshgrid function in Matlab. It returns two matrices x and y where the row vectors in x are linearly spaced between [a1,b1] by n1 whilst the column vectors in y are linearly spaced between (a2,b2) by n2.
diagm k v creates a diagonal matrix using the elements in v as diagonal values. k specifies the main diagonal index. If k > 0 then it is above the main diagonal, if k < 0 then it is below the main diagonal. This function is the same as the diag function in Matlab.
triu k x returns the element on and above the kth diagonal of x. k = 0 is the main diagonal, k > 0 is above the main diagonal, and k < 0 is below the main diagonal.
tril k x returns the element on and below the kth diagonal of x. k = 0 is the main diagonal, k > 0 is above the main diagonal, and k < 0 is below the main diagonal.
symmetric ~upper x creates a symmetric matrix using either upper or lower triangular part of x. If upper is true then it uses the upper part, if upper is false, then symmetric uses the lower part. By default upper is true.
hermitian ~upper x creates a hermitian matrix based on x. By default, the upper triangular part is used for creating the hermitian matrix, but you use the lower part by setting upper=false
bidiagonal upper dv ev creates a bidiagonal matrix using dv and ev. Both dv and ev are row vectors. dv is the main diagonal. If upper is true then ev is superdiagonal; if upper is false then ev is subdiagonal. By default, upper is true.
NOTE: because the diagonal elements in a hermitian matrix must be real, the function set the imaginary part of the diagonal elements to zero by default. In other words, if the diagonal elements of x have non-zero imaginary parts, the imaginary parts will be dropped without a warning.
toeplitz ~c r generates a toeplitz matrix using r and c. Both r and c are row vectors of the same length. If the first elements of c is different from that of r, r's first element will be used.
Note: 1) If c is not passed in, then c = r will be used. 2) If c is not passed in and r is complex, the c = conj r will be used. 3) If r and c have different length, then the result is a rectangular matrix.
hankel ~r c generates a hankel matrix using r and c. c will be the first column and r will be the last row of the returned matrix.
Note: 1) If only c is passed in, the elelments below the anti-diagnoal are zero. 2) If the last element of c is different from the first element of r then the first element of c prevails. 3) c and r can have different length, the return will be an rectangular matrix.
hadamard k n constructs a hadamard matrix of order n. For a hadamard H, we have H'*H = n*I. Currently, this function handles only the cases where n, n/12, or n/20 is a power of 2.
get_index i x returns an array of element values specified by the indices i. The length of array i equals the number of dimensions of x. The arrays in i must have the same length, and each represents the indices in that dimension.
E.g., [| [|1;2|]; [|3;4|] |] returns the value of elements at position (1,3) and (2,4) respectively.
Sourceval set_index : ('a, 'b)t->int array array->'a array-> unit
set_index sets the value of elements in x according to the indices specified by i. The length of array i equals the number of dimensions of x. The arrays in i must have the same length, and each represents the indices in that dimension.
get_fancy s x returns a copy of the slice in x. The slice is defined by a which is an int array. Please refer to the same function in the Owl_dense_ndarray_generic documentation for more details.
This function is used for extended indexing operator since ocaml 4.10.0. The indexing and slicing syntax become much ligher.
Sourceval get_slice : int list list->('a, 'b)t->('a, 'b)t
get_slice axis x aims to provide a simpler version of get_fancy. This function assumes that every list element in the passed in in list list represents a range, i.e., R constructor.
E.g., [[];[0;3];[0]] is equivalent to [R []; R [0;3]; R [0]].
Sourceval set_slice : int list list->('a, 'b)t->('a, 'b)t-> unit
set_slice axis x y aims to provide a simpler version of set_slice. This function assumes that every list element in the passed in in list list represents a range, i.e., R constructor.
E.g., [[];[0;3];[0]] is equivalent to [R []; R [0;3]; R [0]].
Sourceval get_slice_ext : int list array->('a, 'b)t->('a, 'b)t
Please refer to Ndarray document.
Sourceval set_slice_ext : int list array->('a, 'b)t->('a, 'b)t-> unit
rows x a returns the rows (defined in an int array a) of x. The returned rows will be combined into a new dense matrix. The order of rows in the new matrix is the same as that in the array a.
reshape x s returns a new m by n matrix from the m' by n' matrix x. Note that (m * n) must be equal to (m' * n'), and the returned matrix shares the same memory with the original x.
rotate x d rotates x clockwise d degrees. d must be multiple times of 90, otherwise the function will fail. If x is an n-dimensional array, then the function rotates the plane formed by the first and second dimensions.
concat_vh is used to assemble small parts of matrices into a bigger one. E.g. [| [|a; b; c|]; [|d; e; f|]; [|g; h; i|] |] will be concatenated into a big matrix as follows.
Please refer to :doc:`owl_dense_ndarray_generic`. for details.
concatenate ~axis:1 x concatenates an array of matrices along the second dimension. For the matrices in x, they must have the same shape except the dimension specified by axis. The default value of axis is 0, i.e., the lowest dimension on a marix, i.e., rows.
split ~axis parts x splits an ndarray x into parts along the specified axis. This function is the inverse operation of concatenate. The elements in x must sum up to the dimension in the specified axis.
top x n returns the indices of n greatest values of x. The indices are arranged according to the corresponding element values, from the greatest one to the smallest one.
bottom x n returns the indices of n smallest values of x. The indices are arranged according to the corresponding element values, from the smallest one to the greatest one.
sort x performs quicksort of the elelments in x. A new copy is returned as result, the original x remains intact. If you want to perform in-place sorting, please use `sort_` instead.
argsort x returns the indices with which the elements in x are sorted in increasing order. Note that the returned index ndarray has the same shape as that of x, and the indices are 1D indices.
Iteration functions
Sourceval iteri : (int ->'a-> unit)->('a, 'b)t-> unit
iteri f x iterates all the elements in x and applies the user defined function f : int -> int -> float -> 'a. f i j v takes three parameters, i and j are the coordinates of current element, and v is its value.
mapi f x maps each element in x to a new value by applying f : int -> int -> float -> float. The first two parameters are the coordinates of the element, and the third parameter is the value.
foldi ~axis f a x folds (or reduces) the elements in x from left along the specified axis using passed in function f. a is the initial element and in f i acc bacc is the accumulater and b is one of the elements in x along the same axis. Note that i is 1d index of b.
scan ~axis f x scans the x along the specified axis using passed in function f. f acc a b returns an updated acc which will be passed in the next call to f i acc a. This function can be used to implement accumulative operations such as sum and prod functions. Note that the i is 1d index of a in x.
filteri f x uses f : int -> int -> float -> bool to filter out certain elements in x. An element will be included if f returns true. The returned result is a list of coordinates of the selected elements.
iter2_rows f x y iterates rows of two matrices x and `y.
Sourceval iter2_rows :
(('a, 'b)t->('a, 'b)t-> unit)->('a, 'b)t->('a, 'b)t->
unit
Similar to iter2iter2i_rows but without passing in indices.
Sourceval iteri_cols : (int ->('a, 'b)t-> unit)->('a, 'b)t-> unit
iteri_cols f x iterates every column in x and applies function f : int -> mat -> unit to each of them. Column number is passed to f as the first parameter.
Sourceval iter_cols : (('a, 'b)t-> unit)->('a, 'b)t-> unit
Similar to iteri_cols except col number is not passed to f.
filteri_rows f x uses function f : int -> mat -> bool to check each row in x, then returns an int array containing the indices of those rows which satisfy the function f.
filteri_cols f x uses function f : int -> mat -> bool to check each column in x, then returns an int array containing the indices of those columns which satisfy the function f.
mapi_rows f x maps every row in x to a type 'a value by applying function f : int -> mat -> 'a to each of them. The results is an array of all the returned values.
elt_equal x y performs element-wise = comparison of x and y. Assume that a is from x and b is the corresponding element of a from y of the same position. The function returns another binary (0 and 1) ndarray/matrix wherein 1 indicates a = b.
elt_not_equal x y performs element-wise != comparison of x and y. Assume that a is from x and b is the corresponding element of a from y of the same position. The function returns another binary (0 and 1) ndarray/matrix wherein 1 indicates a <> b.
elt_less x y performs element-wise < comparison of x and y. Assume that a is from x and b is the corresponding element of a from y of the same position. The function returns another binary (0 and 1) ndarray/matrix wherein 1 indicates a < b.
elt_greater x y performs element-wise > comparison of x and y. Assume that a is from x and b is the corresponding element of a from y of the same position. The function returns another binary (0 and 1) ndarray/matrix wherein 1 indicates a > b.
elt_less_equal x y performs element-wise <= comparison of x and y. Assume that a is from x and b is the corresponding element of a from y of the same position. The function returns another binary (0 and 1) ndarray/matrix wherein 1 indicates a <= b.
elt_greater_equal x y performs element-wise >= comparison of x and y. Assume that a is from x and b is the corresponding element of a from y of the same position. The function returns another binary (0 and 1) ndarray/matrix wherein 1 indicates a >= b.
elt_equal_scalar x a performs element-wise = comparison of x and a. Assume that b is one element from x The function returns another binary (0 and 1) ndarray/matrix wherein 1 of the corresponding position indicates a = b, otherwise 0.
elt_not_equal_scalar x a performs element-wise != comparison of x and a. Assume that b is one element from x The function returns another binary (0 and 1) ndarray/matrix wherein 1 of the corresponding position indicates a <> b, otherwise 0.
elt_less_scalar x a performs element-wise < comparison of x and a. Assume that b is one element from x The function returns another binary (0 and 1) ndarray/matrix wherein 1 of the corresponding position indicates a < b, otherwise 0.
elt_greater_scalar x a performs element-wise > comparison of x and a. Assume that b is one element from x The function returns another binary (0 and 1) ndarray/matrix wherein 1 of the corresponding position indicates a > b, otherwise 0.
elt_less_equal_scalar x a performs element-wise <= comparison of x and a. Assume that b is one element from x The function returns another binary (0 and 1) ndarray/matrix wherein 1 of the corresponding position indicates a <= b, otherwise 0.
elt_greater_equal_scalar x a performs element-wise >= comparison of x and a. Assume that b is one element from x The function returns another binary (0 and 1) ndarray/matrix wherein 1 of the corresponding position indicates a >= b, otherwise 0.
approx_equal_scalar ~eps x a returns true all the elements in x are approximately equal to a, i.e., abs (x - a) < eps. For complex numbers, the eps applies to both real and imaginary part.
Note: the threshold check is exclusive for the passed in eps.
approx_elt_equal ~eps x y compares the element-wise equality of x and y, then returns another binary (i.e., 0 and 1) ndarray/matrix wherein 1 indicates that two corresponding elements a from x and b from y are considered as approximately equal, namely abs (a - b) < eps.
approx_elt_equal_scalar ~eps x a compares all the elements of x to a scalar value a, then returns another binary (i.e., 0 and 1) ndarray/matrix wherein 1 indicates that the element b from x is considered as approximately equal to a, namely abs (a - b) < eps.
draw_rows x m draws m rows randomly from x. The row indices are also returned in an int array along with the selected rows. The parameter replacement indicates whether the drawing is by replacement or not.
draw_cols x m draws m cols randomly from x. The column indices are also returned in an int array along with the selected columns. The parameter replacement indicates whether the drawing is by replacement or not.
shuffle x shuffles all the elements in x by first shuffling along the rows then shuffling along columns. It is equivalent to shuffle_cols (shuffle_rows x).
load f loads a matrix from file f. The file must be previously saved by using save function.
Sourceval save_txt : ?sep:string ->?append:bool ->out:string ->('a, 'b)t-> unit
save_txt ~sep ~append ~out x saves the matrix x into a text file out delimited by the specified string sep (default: tab). If append is false (it is by default), an existing file will be truncated and overwritten. If append is true and the file exists, new rows will be appended to it. Files are created, if necessary, with the AND of 0o644 and the user's umask value. Note that the operation can be very time consuming.
load_npy file load a npy file into a matrix of type k. If the matrix is in the file is not of type k, fails with [file]: incorrect format. This function is implemented using npy-ocaml https://github.com/LaurentMazare/npy-ocaml.
im_d2z x returns all the imaginary components of x in a new ndarray of same shape.
Sourceval min : ?axis:int ->?keep_dims:bool ->('a, 'b)t->('a, 'b)t
min x returns the minimum of all elements in x along specified axis. If no axis is specified, x will be flattened and the minimum of all the elements will be returned. For two complex numbers, the one with the smaller magnitude will be selected. If two magnitudes are the same, the one with the smaller phase will be selected.
min' x is similar to min but returns the minimum of all elements in x in scalar value.
Sourceval max : ?axis:int ->?keep_dims:bool ->('a, 'b)t->('a, 'b)t
max x returns the maximum of all elements in x along specified axis. If no axis is specified, x will be flattened and the maximum of all the elements will be returned. For two complex numbers, the one with the greater magnitude will be selected. If two magnitudes are the same, the one with the greater phase will be selected.
max_i x returns the maximum of all elements in x as well as its index.
Sourceval minmax_i : ('a, 'b)t->('a * int array) * ('a * int array)
minmax_i x returns ((min_v,min_i), (max_v,max_i)) where (min_v,min_i) is the minimum value in x along with its index while (max_v,max_i) is the maximum value along its index.
conj x computes the conjugate of the elements in x and returns the result in a new matrix. If the passed in x is a real matrix, the function simply returns a copy of the original x.
reci_tol ~tol x computes the reciprocal of every element in x. Different from reci, reci_tol sets the elements whose abs value smaller than tol to zeros. If tol is not specified, the default Owl_utils.eps Float32 will be used. For complex numbers, refer to Owl's doc to see how to compare.
fix x rounds each element of x to the nearest integer toward zero. For positive elements, the behavior is the same as floor. For negative ones, the behavior is the same as ceil.
modf x performs modf over all the elements in x, the fractal part is saved in the first element of the returned tuple whereas the integer part is saved in the second element.
softmax x computes the softmax functions (exp x) / (sum (exp x)) of all the elements along the specified axis in x and returns the result in a new ndarray.
l2norm_sqr x calculates the square of l2-norm (or l2norm, Euclidean norm) of all elements in x. The function uses conjugate transpose in the product, hence it always returns a float number.
diff ~axis ~n x calculates the n-th difference of x along the specified axis.
Parameters: * axis: axis to calculate the difference. The default value is the highest dimension. * n: how many times to calculate the difference. The default value is 1.
Return: * The difference ndarray y. Note the shape of y 1 less than that of x along specified axis.
mat2gray ~amin ~amax x converts the matrix x to the intensity image. The elements in x are clipped by amin and amax, and they will be between 0. and 1. after conversion to represents the intensity.
ssqr x a computes the sum of squared differences of all the elements in x from constant a. This function only computes the square of each element rather than the conjugate transpose as sqr_nrm2 does.
clip_by_value ~amin ~amax x clips the elements in x based on amin and amax. The elements smaller than amin will be set to amin, and the elements greater than amax will be set to amax.
cov ~a calculates the covariance matrix of a wherein each row represents one observation and each column represents one random variable. a is normalised by the number of observations-1. If there is only one observation, it is normalised by 1.
cov ~a ~b takes two matrices as inputs. The functions flatten a and b first then returns a 2 x 2 matrix, so two must have the same number of elements.
kron a b calculates the Kronecker product between the matrices a and b. If a is an m x n matrix and b is a p x q matrix, then kron(a,b) is an m*p x n*q matrix formed by taking all possible products between the elements of a and the matrix b.
cast kind x casts x of type ('c, 'd) t to type ('a, 'b) t specify by the passed in kind parameter. This function is a generalisation of the other type casting functions such as cast_s2d, cast_c2z, and etc.
create_ ~out value initializes the matrix out with the scalar value value. The operation is performed in-place.
Sourceval uniform_ : ?a:'a->?b:'a->out:('a, 'b)t-> unit
uniform_ ?a ?b ~out fills the matrix out with random values drawn from a uniform distribution over the interval [a, b\). If a and b are not provided, the default interval is [0, 1\). The operation is performed in-place.
Sourceval bernoulli_ : ?p:float ->out:('a, 'b)t-> unit
bernoulli_ ?p ~out fills the matrix out 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. The operation is performed in-place.
ones_ ~out fills the matrix out with ones. The operation is performed in-place.
Sourceval one_hot_ : out:('a, 'b)t->int ->('a, 'b)t-> unit
one_hot_ ~out depth x converts the matrix x into a one-hot encoded matrix with the specified depth, and stores the result in out. The operation is performed in-place.
copy_ ~out src copies the data from ndarray src to destination out. The operation is performed in-place.
Sourceval reshape_ : out:('a, 'b)t->('a, 'b)t-> unit
reshape_ ~out x reshapes the matrix x and stores the result in out. The total number of elements must remain the same. The operation is performed in-place.
Sourceval transpose_ : out:('a, 'b)t->?axis:int array->('a, 'b)t-> unit
transpose_ ~out ?axis x transposes the matrix x according to the specified axes and stores the result in out. If axis is not provided, the transpose is performed with the default axes. The operation is performed in-place.
Sourceval sum_ : out:('a, 'b)t->axis:int ->('a, 'b)t-> unit
sum_ ~out ~axis x computes the sum of elements along the specified axis of the matrix x and stores the result in out. The operation is performed in-place.
Sourceval min_ : out:('a, 'b)t->axis:int ->('a, 'b)t-> unit
min_ ~out ~axis x computes the minimum value along the specified axis of the matrix x and stores the result in out. The operation is performed in-place.
Sourceval max_ : out:('a, 'b)t->axis:int ->('a, 'b)t-> unit
max_ ~out ~axis x computes the maximum value along the specified axis of the matrix x and stores the result in out. The operation is performed in-place.
Sourceval add_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
add_ x y is similar to add function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval sub_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
sub_ x y is similar to sub function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval mul_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
mul_ x y is similar to mul function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval div_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
div_ x y is similar to div function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval pow_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
pow_ x y is similar to pow function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval atan2_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
atan2_ x y is similar to atan2 function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval hypot_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
hypot_ x y is similar to hypot function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval fmod_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
fmod_ x y is similar to fmod function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval min2_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
min2_ x y is similar to min2 function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval max2_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
max2_ x y is similar to max2 function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval add_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
add_scalar_ x y is similar to add_scalar function but the output is written to x.
Sourceval sub_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
sub_scalar_ x y is similar to sub_scalar function but the output is written to x.
Sourceval mul_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
mul_scalar_ x y is similar to mul_scalar function but the output is written to x.
Sourceval div_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
div_scalar_ x y is similar to div_scalar function but the output is written to x.
Sourceval pow_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
pow_scalar_ x y is similar to pow_scalar function but the output is written to x.
Sourceval atan2_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
atan2_scalar_ x y is similar to atan2_scalar function but the output is written to x.
Sourceval fmod_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
fmod_scalar_ x y is similar to fmod_scalar function but the output is written to x.
Sourceval scalar_add_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_add_ a x is similar to scalar_add function but the output is written to x.
Sourceval scalar_sub_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_sub_ a x is similar to scalar_sub function but the output is written to x.
Sourceval scalar_mul_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_mul_ a x is similar to scalar_mul function but the output is written to x.
Sourceval scalar_div_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_div_ a x is similar to scalar_div function but the output is written to x.
Sourceval scalar_pow_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_pow_ a x is similar to scalar_pow function but the output is written to x.
Sourceval scalar_atan2_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_atan2_ a x is similar to scalar_atan2 function but the output is written to x.
Sourceval scalar_fmod_ : ?out:('a, 'b)t->'a->('a, 'b)t-> unit
scalar_fmod_ a x is similar to scalar_fmod function but the output is written to x.
Sourceval fma_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
fma_ ~out x y z is similar to fma x y z function but the output is written to out.
Sourceval dot_ :
?transa:bool ->?transb:bool ->?alpha:'a->?beta:'a->c:('a, 'b)t->('a, 'b)t->('a, 'b)t->
unit
Refer to :doc:`owl_dense_matrix_generic`
Sourceval conj_ : ?out:('a, 'b)t->('a, 'b)t-> unit
conj_ x is similar to conj but output is written to x
erf_ x is similar to erf but output is written to x
Sourceval erfc_ : ?out:('a, 'b)t->('a, 'b)t-> unit
erfc_ x is similar to erfc but output is written to x
Sourceval relu_ : ?out:('a, 'b)t->('a, 'b)t-> unit
relu_ x is similar to relu but output is written to x
Sourceval softplus_ : ?out:('a, 'b)t->('a, 'b)t-> unit
softplus_ x is similar to softplus but output is written to x
Sourceval softsign_ : ?out:('a, 'b)t->('a, 'b)t-> unit
softsign_ x is similar to softsign but output is written to x
Sourceval sigmoid_ : ?out:('a, 'b)t->('a, 'b)t-> unit
sigmoid_ x is similar to sigmoid but output is written to x
Sourceval softmax_ : ?out:('a, 'b)t->?axis:int ->('a, 'b)t-> unit
softmax_ x is similar to softmax but output is written to x
Sourceval cumsum_ : ?out:('a, 'b)t->?axis:int ->('a, 'b)t-> unit
cumsum_ x is similar to cumsum but output is written to x
Sourceval cumprod_ : ?out:('a, 'b)t->?axis:int ->('a, 'b)t-> unit
cumprod_ x is similar to cumprod but output is written to x
Sourceval cummin_ : ?out:('a, 'b)t->?axis:int ->('a, 'b)t-> unit
cummin_ x is similar to cummin but output is written to x
Sourceval cummax_ : ?out:('a, 'b)t->?axis:int ->('a, 'b)t-> unit
cummax_ x is similar to cummax but output is written to x
Sourceval dropout_ : ?out:('a, 'b)t->?rate:float ->('a, 'b)t-> unit
dropout_ x is similar to dropout but output is written to x
Sourceval elt_equal_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
elt_equal_ x y is similar to elt_equal function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval elt_not_equal_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
elt_not_equal_ x y is similar to elt_not_equal function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval elt_less_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
elt_less_ x y is similar to elt_less function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval elt_greater_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
elt_greater_ x y is similar to elt_greater function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval elt_less_equal_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
elt_less_equal_ x y is similar to elt_less_equal function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval elt_greater_equal_ : ?out:('a, 'b)t->('a, 'b)t->('a, 'b)t-> unit
elt_greater_equal_ x y is similar to elt_greater_equal function but the output is written to out. You need to make sure out is big enough to hold the output result.
Sourceval elt_equal_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
elt_equal_scalar_ x a is similar to elt_equal_scalar function but the output is written to x.
Sourceval elt_not_equal_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
elt_not_equal_scalar_ x a is similar to elt_not_equal_scalar function but the output is written to x.
Sourceval elt_less_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
elt_less_scalar_ x a is similar to elt_less_scalar function but the output is written to x.
Sourceval elt_greater_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
elt_greater_scalar_ x a is similar to elt_greater_scalar function but the output is written to x.
Sourceval elt_less_equal_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
elt_less_equal_scalar_ x a is similar to elt_less_equal_scalar function but the output is written to x.
Sourceval elt_greater_equal_scalar_ : ?out:('a, 'b)t->('a, 'b)t->'a-> unit
elt_greater_equal_scalar_ x a is similar to elt_greater_equal_scalar function but the output is written to x.