remove unused code after refactoring optimizations into profiling-sensitive and profiling-insensitive (#32106)
Summary:
After we removed `Specialize_AutogradZero` from the optimization pipeline of the simple executor mode, we don't need to mark any inputs as undefined in `autodiff`. Also, `needsGradient` in `graph_executor.cpp` never runs on graph with profiling information, so I removed that code as well.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32106
Differential Revision: D19374238
Pulled By: Krovatkin
fbshipit-source-id: 4223d3efe3c904a55a28471e5ae9593017ce3e07