MCPcopy Create free account
hub / github.com/pytorch/tutorials / forward

Method forward

advanced_source/numpy_extensions_tutorial.py:89–95  ·  view source on GitHub ↗
(ctx, input, filter, bias)

Source from the content-addressed store, hash-verified

87class ScipyConv2dFunction(Function):
88 @staticmethod
89 def forward(ctx, input, filter, bias):
90 # detach so we can cast to NumPy
91 input, filter, bias = input.detach(), filter.detach(), bias.detach()
92 result = correlate2d(input.numpy(), filter.numpy(), mode='valid')
93 result += bias.numpy()
94 ctx.save_for_backward(input, filter, bias)
95 return torch.as_tensor(result, dtype=input.dtype)
96
97 @staticmethod
98 def backward(ctx, grad_output):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected