Skip to main content

TensorDeviceTransfer

Trait TensorDeviceTransfer 

Source
pub trait TensorDeviceTransfer {
    // Required methods
    fn download_to_host(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>;
    fn upload_host_tensor(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>;
}
Expand description

Device transfer operations on backend boundaries.

§Examples

use tenferro_tensor::TensorDeviceTransfer;

fn accepts_transfer<B: TensorDeviceTransfer>(_backend: &mut B) {}

Required Methods§

Source

fn download_to_host(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>

Explicitly copy a provider-owned read target into host storage.

Implementations must not return the input unchanged or stage through an unrelated provider. A backend that cannot transfer the requested read target returns a typed unsupported error.

§Errors

Returns crate::Error::Unsupported when the implementation cannot perform the requested transfer, or a typed validation/backend error when the source cannot be read.

Source

fn upload_host_tensor(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>

Explicitly copy a host read target into provider storage.

§Errors

Returns crate::Error::Unsupported when the implementation cannot perform the requested transfer, or a typed validation/backend error when the source cannot be read.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§