Hi everyone,
I’m trying to write a custom backend for pytorch 2.0 compile and I have a question. Say I have the following code:
class DoubleLinear(nn.Module):
def __init__(self):
super().__init__()
self.l1 = nn.Linear(32, 32, bias=True)
self.l2 = nn.Linear(32, 32, bias=False)
def forward(self, x1, x2):
m1 = self.l1(x1)
print (m1)
m2 = self.l2(x2)
return m1 + m2, m1
This gets divided into two subgraphs:
pybuda/test/test_pt_2_0.py::test_torch opcode name target args kwargs
------------- ------- ----------------------- -------------- --------
placeholder x1 x1 () {}
call_module self_l1 self_l1 (x1,) {}
call_function add <built-in function add> (self_l1, 1.0) {}
output output output ((add,),) {}
and
opcode name target args kwargs
------------- ------- ----------------------- ------------- --------
placeholder x2 x2 () {}
placeholder m1 m1 () {}
call_module self_l2 self_l2 (x2,) {}
call_function add <built-in function add> (m1, self_l2) {}
output output output ((add,),) {}
How can I tell that input m1 in the second subgraph is the output of the first?