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

Class M

fx/subgraph_rewriter_basic_use.py:29–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28# Sample module
29class M(torch.nn.Module):
30 def __init__(self):
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 1

Calls

no outgoing calls

Tested by

no test coverage detected