Module collenchyma::tensor [] [src]

Provides the functionality for memory management across devices.

A Tensor is a potentially multi-dimensional matrix containing information about the actual data and it's structure. A Collenchyma Tensor tracks the memory copies of the numeric data of an Tensor across the devices of the Backend and manages

This is important, as this provides a unified data interface for exectuing Tensor operations on CUDA, OpenCL and common host CPU.

A memory copy represents one logical unit of data, which might me located at the host. The Tensor, tracks the location of the data blob across the various devices that the backend might consist of. This allows us to run operations on various backends with the same data blob.

Terminology

A Tensor is a homogeneous multi-dimensional array - a table of elements (usually numeric elements) of the same type, indexed by tuples of positive integers. In Collenchyma dimensions of a Tensor describe what axis are for a coordinate system. The numbers of dimensions is the rank. A scala value like 3 has the rank 0, and a Rust array like [1, 2, 3] has a rank of 1 as it has one dimension. A array of arrays like [[1, 2, 3], [2, 3]] has a rank of 2 as it has two dimensions. The number of elements for a dimension is called length. And the number of all elements for each dimension summed up is the size. These meta data about a Tensor is called the descriptor of the Tensor.

Examples

Create a SharedTensor and fill it with some numbers:

use collenchyma::framework::IFramework;
use collenchyma::frameworks::Native;
use collenchyma::tensor::SharedTensor;
// allocate memory
let native = Native::new();
let device = native.new_device(native.hardwares()).unwrap();
let shared_data = &mut SharedTensor::<i32>::new(&device, &5).unwrap();
// fill memory with some numbers
let local_data = [0, 1, 2, 3, 4];
let data = shared_data.get_mut(&device).unwrap().as_mut_native().unwrap();

Structs

SharedTensor

Container that handles synchronization of Memory of type T.

Enums

Error

Errors than can occur when synchronizing memory.

Traits

ITensorDesc

Describes the Descriptor of a Tensor.

IntoTensorDesc

Describes a conversion into a Tensor Descriptor.

Type Definitions

TensorDesc

Describes the Descriptor of a SharedTensor.