package caisar

  1. Overview
  2. Docs
A platform for characterizing the safety and robustness of artificial intelligence based software

Install

dune-project
 Dependency

Authors

Maintainers

Sources

caisar-5.0.tbz
sha256=05024c094f68b82873f2c99c89d4f196049ac63b7d1d4f68ae1a1e3b08de7342
sha512=a26c724a19fca7c22a000367d1cd79c1e0474f373bf7265449928e55275ac44103190536dc8c76f5ac00a2a1897c3bd2ee06bb6f22140165079b72a27011e6df

doc/caisar.nir/Nir/Tensor/index.html

Module Nir.TensorSource

Immutable tensor module

Tensors are multidimensional arrays used to represent numerical such as a neural network paramters.

This library relies on Bigarray.Genarray to instanciante tensors.

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.

Sourcetype ('a, 'b) t
Sourceval of_tensor : ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> ('a, 'b) t
Sourceval to_tensor : ('a, 'b) t -> ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t
Sourceval create_1_float : float -> (float, Bigarray.float64_elt) t

create_1_float f returns an unidimentional tensor with one floating point value f.

Sourceval create_1_int64 : int64 -> (int64, Bigarray.int64_elt) t

create_1_int64 i returns an unidimentional tensor with one int64 value i.

Sourceval create_const_float : Shape.t -> float -> (float, Bigarray.float64_elt) t

create_const_float shape v returns a tensor of shape shape where each value is initialized to v.

Sourceval shape : ('a, 'b) t -> Shape.t
Sourceval flatten : ('a, 'b) t -> 'a list

flatten t returns all values stored in t as a flat list.

Sourceval of_array1 : Shape.t -> ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> ('a, 'b) t
Sourceval get : ('a, 'b) t -> int array -> 'a

get t sh returns the value stored at coordinates sh in t.

  • raises Invalid_argument

    if sh does not exactly match the shape of t, or if sh is out-of-bounds.