@SelvamArul Glad you solved the issue, using @TomLiftoff’s approach.
Note that pytorch is in part a wrapper around a c++ library called THNN.  In theory, you might be able to call into that directly, skipping much of the python bit altogether. You miss out on some of the python-space libraries, so it really depends on what you need/are doing.