MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / backward

Method backward

monai/visualize/gradient_based.py:39–45  ·  view source on GitHub ↗
(ctx, grad_output)

Source from the content-addressed store, hash-verified

37
38 @staticmethod
39 def backward(ctx, grad_output):
40 x, _ = ctx.saved_tensors
41 pos_mask_1 = (x > 0).type_as(grad_output)
42 pos_mask_2 = (grad_output > 0).type_as(grad_output)
43 y = torch.mul(grad_output, pos_mask_1)
44 grad_input = torch.mul(y, pos_mask_2)
45 return grad_input
46
47
48class _GradReLU(torch.nn.Module):

Callers 1

__call__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected