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

Method forward

fx/subgraph_rewriter_basic_use.py:33–38  ·  view source on GitHub ↗
(self, x, w1, w2)

Source from the content-addressed store, hash-verified

31 super().__init__()
32
33 def forward(self, x, w1, w2):
34 val1 = torch.neg(w1)
35 m1 = torch.cat([val1, w2]).sum()
36 val2 = torch.neg(w1)
37 m2 = torch.cat([val2, w2]).sum()
38 return x + torch.max(m1) + torch.max(m2)
39
40# Symbolically trace an instance of `M`
41traced = symbolic_trace(M())

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected