# tensorplay.custom_bwd

Source: https://www.tensorplay.cn/docs/generated/tensorplay.custom_bwd.html

# tensorplay.custom_bwd

tensorplay.custom_bwd(bwd=None, *, device_type: [str](https://docs.python.org/3/library/stdtypes.html#str))[[source]](../_modules/tensorplay/amp/autocast_mode.html#custom_bwd)

Create a helper decorator for backward methods of custom autograd functions.

Autograd functions are subclasses of tensorplay.autograd.Function.
Ensures that backward executes with the same autocast state as forward.

Parameters:

device_type ([str](https://docs.python.org/3/library/stdtypes.html#str)) – Device type to use. ‘cuda’, ‘cpu’.
The type is the same as the type attribute of a [tensorplay.device](tensorplay.device.html#tensorplay.device).
Thus, you may obtain the device type of a tensor using Tensor.device.type.
