Struct coaster::tensor::SharedTensor[][src]

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

Container that handles synchronization of [Memory][1] of type T. [1]: ../memory/index.html

Implementations

Create new Tensor by allocating [Memory][1] on a Device. [1]: ../memory/index.html

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.