Skip to content
Go to file
Cannot retrieve contributors at this time
72 lines (53 sloc) 3.63 KB

Tensor for F#

Build Status Build status

A tensor is an n-dimensional array of an arbitrary data type (for example single or double). Tensors of data type 'T are implemented by the Tensor<'T> type.

A tensor can be either stored in host memory or in the memory of a GPU computing device. Currently only nVidia cards implementing the CUDA API are supported. The API for host and GPU stored tensors is mostly equal, thus a program can make use of GPU accelerated operations without porting effort.

The tensor library provides functionality similar to Numpy's Ndarray and MATLAB arrays, including vector-wise operations, reshaping, slicing, broadcasting, masked assignment, reduction operations and BLAS operations.

This open source library is written in F# and targets the .NET Standard 2.0 platform with Linux, MacOS and Microsoft Windows as supported operating systems.

Features provided by the core Tensor library

  • Core features
    • n-dimensional arrays (tensors) in host memory or on CUDA GPUs
    • element-wise operations (addition, multiplication, absolute value, etc.)
    • basic linear algebra operations (dot product, SVD decomposition, matrix inverse, etc.)
    • reduction operations (sum, product, average, maximum, arg max, etc.)
    • logic operations (comparison, and, or, etc.)
    • views, slicing, reshaping, broadcasting (similar to NumPy)
    • scatter and gather by indices
    • standard functional operations (map, fold, etc.)
  • Data exchange
    • read/write support for HDF5 (.h5)
    • interop with standard F# types (Seq, List, Array, Array2D, Array3D, etc.)
  • Performance
    • host: SIMD and Intel MKL accelerated operations
    • CUDA GPU: all operations performed locally on GPU and cuBLAS used for matrix operations

Additional features provided by Tensor.Algorithm

  • Matrix algebra (integer, rational)
    • Row echelon form
    • Smith normal form
    • Kernel, co-kernel and (pseudo-)inverse
  • Matrix decomposition (floating point)
    • Principal component analysis (PCA)
    • ZCA whitening
  • Misc
    • Bezout's identity
    • Loading of NumPy's .npy and .npz files.



To get an overview of available functions by category, see Tensor at a glance. We also provide full reference documentation.

To start using the library, follow the installation guide and the getting started guide.


Check out our example project that demonstrates essential features of the library at


Sebastian Urban
Marcus Basalla
Johannes Langer
Wiebke Köpp

You can’t perform that action at this time.