Struct coaster::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.

Get memory for reading on the specified device. Can fail if memory allocation fails, or if tensor wasn't initialized yet.

Get memory for reading and writing on the specified device. Can fail if memory allocation fails, or if tensor wasn't initialized yet.

Get memory for writing only. This function skips synchronization and initialization checks, since contents will be overwritten anyway. By convention caller must fully initialize returned memory. Failure to do so may result in use of uninitialized data later. If caller has failed to overwrite memory, for some reason, it must call invalidate() to return vector to uninitialized state.

Drops memory allocation on the specified device. Returns error if no memory has been allocated on this device.

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 for SharedTensor<T>
[src]

Formats the value using the given formatter.