enable_grad

class dragon.vm.torch.enable_grad[source]

Context-manager to enable gradient calculation.

Examples:

x = torch.ones(2, 3, requires_grad=True)
with torch.no_grad():
    with torch.enable_grad():
        y = x + 1
y.backward()  # 0 error(s), 0 warning(s)

__init__

enable_grad.__init__()[source]

Create a enable_grad context manager.