Torch fx forward

model = torchvision.models.resnet18(pretrained=True)
x = torch.rand(1,3,224,224)
m = torch.fx.symbolic_trace(model)
m.layer1(x)

error:*** NotImplementedError

how to solve it.

model = torchvision.models.resnet18(pretrained=True)
x = torch.rand(1,3,224,224)
m = torch.fx.symbolic_trace(model)
m(x)

why not m.layer1(x), sometimes I only use to infer part of network.

This module is used to modify the graph. If you only want layer1(x), you only get it from module rather than fx. If you can combine some parts, you can modify graph and generate a new one code.