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

Method forward

intermediate_source/torch_export_tutorial.py:261–272  ·  view source on GitHub ↗
(
        self,
        w: torch.Tensor,  # [6, 5]
        x: torch.Tensor,  # [4]
        y: torch.Tensor,  # [8, 4]
        z: torch.Tensor,  # [32]
    )

Source from the content-addressed store, hash-verified

259 self.l = torch.nn.Linear(5, 3)
260
261 def forward(
262 self,
263 w: torch.Tensor, # [6, 5]
264 x: torch.Tensor, # [4]
265 y: torch.Tensor, # [8, 4]
266 z: torch.Tensor, # [32]
267 ):
268 x0 = x + y # [8, 4]
269 x1 = self.l(w) # [6, 3]
270 x2 = x0.flatten() # [32]
271 x3 = x2 + z # [32]
272 return x1, x3
273
274######################################################################
275# By default, ``torch.export`` produces a static program. One consequence of this is that at runtime,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected