Struct collenchyma::tensor::SharedTensor [] [src]

pub struct SharedTensor<T> { /* fields omitted */ }

Container that handles synchronization of Memory of type T.

Methods

impl<T> SharedTensor<T>
[src]

Create new Tensor by allocating Memory on a Device.

Change the shape of the Tensor.

Will return an Error if size of new shape is not equal to the old shape. If you want to change the shape to one of a different size, use resize.

Change the size and shape of the Tensor.

Caution: Drops all copies which are not on the current device.

'reshape' is preffered over this method if the size of the old and new shape are identical because it will not reallocate memory.

Synchronize memory from latest location to destination.

Get a reference to the memory copy on the provided device.

Returns None if there is no memory copy on the device.

Get a mutable reference to the memory copy on the provided device.

Returns None if there is no memory copy on the device.

Removes Copy from SharedTensor and therefore aquires ownership over the removed memory copy for synchronizing.

Track a new device and allocate memory on it.

Returns an error if the Tensor is already tracking the device.

Returns the device that contains the up-to-date memory copy.

Returns the number of elements for which the Tensor has been allocated.

Returns the descriptor of the Tensor.

Returns the allocated Memory size in bytes.

Trait Implementations

impl<T: Debug> Debug for SharedTensor<T>
[src]

Formats the value using the given formatter.