‘len’ is not supported in symbolic tracing by default

Hello, I now have a requirement to parse the yolov3 network constructed by mmdetion. In mmdetion, the yolov3 network is divided into backbone, neck, bbox, and 3 parts. But when I use torch.fx to parse this model, I have the following problem. I tried to use the torch.fx.wrap(‘len’) tutorial given by the official website to solve this problem. It is very strange that the example on the official website runs successfully, but it does not take effect in the code I wrote. How to solve the problem that ‘len’ cannot be resolved?


code:

I’m not exactly sure what “module scope” means here, but would defining it at the “global” score help (i.e. move if right after the imports and rerun your code.

I tried putting torch.fx.wrap('len') anywhere, including the global, but it didn’t solve the problem

i have sovled this problem,please delete it.

I have encountered the same problem. How did you solve it?

@yang_wang I have a same issue. Could you please let me know how to figure out?