Disable GC if fraction is not set (#76648)
Summary:
If fraction is not set, don't trigger GC!
In the current codebase, if you turn on the GC and *do not set the fraction* in the application, the GC will be triggered every time which does not make much sense -- perf will be as bad as turning off the caching allocator.
With this fix, GC is invoked only when the fraction is set.
Test Plan: Unit tests
Differential Revision: D36026128
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76648
Approved by: https://github.com/yinghai