Skip to content
fn

storage_device

→Device
Device storage_device(const int & s)

The device a bare Storage belongs to — the one place it is read off one, for a gradient wrapped as a tensor (a hook's argument, a custom Function's grad_output, a backward seed) and anything else that holds a Storage without its tensor.

Returns

Device

Device::GPU for GpuStorage; the recorded device for PhantomStorage, which has no kind to tell it by; otherwise Device::CPU — a SharedStorage buffer is read through its CPU view.