How to generate LLVM IR from the pytorch code

I’ve seen in forums that people used -dump-ir command on the command line to get it. Have no idea where to specify it. Can anyone explain? or give a sample code to generate the IR?

-dump-ir is a command line option specified in lib/Optimizer/IROptimizer.cpp. It should be available on the command line for any binary that links against the Optimizer lib. For example, you can specify it when running the image-classifier. There are examples of running the image-classifier at tests/images/run.sh, so you could append it to any of those. It also should work when running unit tests that link against Optimizer, e.g. ./tests/OperatorTest -dump-ir.

Thanks @jfix. I’ll try to execute and get back to you. If you have some good tutorial on this please share I need it.

I would suggest reading our doc on Testing.