Skip to content
class

ToDeviceBackward

extendskernel::IKernel
ToDeviceBackward

Backward node for to_device_op.

Returns the incoming gradient on the device the forward input lived on.

Attributes

src_device_Device
Device of the forward input; the gradient is moved back there.

Methods

4
fn

apply

int apply(int grad_out)

Eager backward: the gradient's storage, moved to src_device_.

fn

apply_for_graph

int apply_for_graph(const int & grad_out)

Graph-mode backward: to_device_op again, so a second derivative crosses the devices through the same differentiable op.