package caisar
Library
Module
Module type
Parameter
Class
Class type
val pp_shape :
Ppx_deriving_runtime.Format.formatter ->
shape ->
Ppx_deriving_runtime.unit
val show_shape : shape -> Ppx_deriving_runtime.string
val all_coords : shape -> Base.int Base.list Base.list
create sh
initialize a tensor with the given shape sh
with a default value, depending of the type of the tensor
get t idx
returns the value in tensor t
stored at coordinates idx
. Throw an error if the coordinate is invalid.
set_idx t idx v
sets value v
for tensor t
at idx
. Throw an error if the coordinate is invalid.
equal f t1 t2
applies f
to all values of t1
and t2
, and returns true if all applications of f returned true.
get_shape t
returns the shape of t
.
flatten t
returns a flattened version of t
.
val flatten : ('a, 'b) t -> 'a Base.list
num_neurons sh
returns the total number of neurons given a shape
val num_neurons : shape -> Base.int
get flatnd_idx idx sh flt
returns the value that would be stored at index idx
under a tensor of shape sh
, given the flattened version of this tensor flt
.
transpose_2d t
returns a copy of the tensor t
with its two last dimension exchanged.
unsqueeze sh1 sh2
returns the lowest common shape between sh1
and sh2
, and None if there is no common shape. A common shape is when a shape of higher dimension has only 1 coordinates on non-shared dimensions with the other.